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 TameMate v0.8.0
TameMate.dll
Decompiled 3 days 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.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Extensions; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using TMPro; using TameMate.OceanHorn; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("TameMate")] [assembly: AssemblyDescription("Companion & Riding Overhaul for Valheim")] [assembly: AssemblyCompany("MitsurugiCM")] [assembly: AssemblyProduct("TameMate")] [assembly: ComVisible(false)] [assembly: AssemblyFileVersion("0.6.6.0")] [assembly: AssemblyVersion("0.7.45.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 TameMate { internal static class AltairBridge { private static bool s_cofreFijoActive; private static bool s_regresoActive; private static bool s_mesaActive; private static bool s_crafteoActive; private static object s_cofreFijoInstance; private static MethodInfo s_reunirDestinosMethod; private static MethodInfo s_elegirDestinoMethod; private static MethodInfo s_moverMethod; private static FieldInfo s_destinoInventarioField; private static FieldInfo s_destinoCofreField; private static MethodInfo s_metodoGuardarCofreMethod; private static readonly MethodInfo s_containerSaveMethod = AccessTools.Method(typeof(Container), "Save", (Type[])null, (Type[])null); private static readonly Dictionary<int, float> s_companionGodShieldUntil = new Dictionary<int, float>(); internal static bool IsCofreFijoActive => s_cofreFijoActive; internal static bool IsRegresoActive => s_regresoActive; internal static bool IsMesaActive => s_mesaActive; internal static bool IsCrafteoActive => s_crafteoActive; internal static void Init(Harmony harmony) { if (harmony == null) { return; } try { if (Chainloader.PluginInfos.ContainsKey("altairfernando.cofrefijo")) { HookCofreFijo(harmony); } if (Chainloader.PluginInfos.ContainsKey("altairfernando.regresoalcadaver")) { HookRegresoAlCadaver(harmony); } if (Chainloader.PluginInfos.ContainsKey("altairfernando.mesadetrabajo")) { HookMesaDeTrabajo(harmony); } if (Chainloader.PluginInfos.ContainsKey("altairfernando.crafteoportandas")) { HookCrafteoPorTandas(harmony); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[AltairBridge] Advertencia inicializando puente: " + ex.Message)); } } } private static void HookCofreFijo(Harmony harmony) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Invalid comparison between Unknown and I4 try { Type type = AccessTools.TypeByName("CofreFijo.CofreFijoPlugin, CofreFijo"); if (type == null) { return; } MethodInfo methodInfo = AccessTools.Method(type, "Rellenar", (Type[])null, (Type[])null); if (methodInfo != null) { MethodInfo methodInfo2 = AccessTools.Method(typeof(AltairBridge), "CofreFijo_Rellenar_Prefix", (Type[])null, (Type[])null); harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } FieldInfo fieldInfo = AccessTools.Field(type, "_teclaRellenar"); if (fieldInfo != null) { object obj = AccessTools.Field(type, "Instancia")?.GetValue(null); if (obj != null && fieldInfo.GetValue(obj) is ConfigEntry<KeyCode> val && (int)val.Value == 117) { val.Value = (KeyCode)0; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[AltairBridge] 'TeclaRellenar' de CofreFijo reasignada a None para liberar 'U' exclusivamente para la Rueda Rúnica."); } } } MethodInfo methodInfo3 = AccessTools.Method(type, "Update", (Type[])null, (Type[])null); if (methodInfo3 != null) { MethodInfo methodInfo4 = AccessTools.Method(typeof(AltairBridge), "CofreFijo_Update_Prefix", (Type[])null, (Type[])null); harmony.Patch((MethodBase)methodInfo3, new HarmonyMethod(methodInfo4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo5 = AccessTools.Method(type, "Enviar", (Type[])null, (Type[])null); if (methodInfo5 != null) { MethodInfo methodInfo6 = AccessTools.Method(typeof(AltairBridge), "CofreFijo_Enviar_Postfix", (Type[])null, (Type[])null); harmony.Patch((MethodBase)methodInfo5, (HarmonyMethod)null, new HarmonyMethod(methodInfo6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } s_cofreFijoInstance = AccessTools.Field(type, "Instancia")?.GetValue(null); s_reunirDestinosMethod = AccessTools.Method(type, "ReunirDestinos", new Type[1] { typeof(Player) }, (Type[])null); s_elegirDestinoMethod = AccessTools.Method(type, "ElegirDestino", (Type[])null, (Type[])null); s_moverMethod = AccessTools.Method(type, ModLanguage.Text("Mover"), new Type[4] { typeof(Inventory), typeof(Inventory), typeof(ItemData), typeof(int) }, (Type[])null); Type type2 = AccessTools.Inner(type, ModLanguage.Text("Destino")); if (type2 != null) { s_destinoInventarioField = AccessTools.Field(type2, "Inventario"); s_destinoCofreField = AccessTools.Field(type2, "Cofre"); } s_metodoGuardarCofreMethod = AccessTools.Field(type, "MetodoGuardarCofre")?.GetValue(null) as MethodInfo; s_cofreFijoActive = true; ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)"[AltairBridge] Mod 'CofreFijo' conectado y armonizado con éxito (Alforjas + Bloqueo Rellenar en 'U')."); } } catch (Exception ex) { ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogWarning((object)("[AltairBridge] Error enganchando CofreFijo: " + ex.Message)); } } } private static bool CofreFijo_Rellenar_Prefix() { return false; } private static bool CofreFijo_Update_Prefix() { if (CommandWheel.IsOpen || TameMateGuidebook.IsOpen) { return false; } return true; } private static void CofreFijo_Enviar_Postfix(Player jugador) { if (!Object.op_Implicit((Object)(object)jugador)) { return; } try { OffloadCompanionSaddlebags(jugador); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[AltairBridge] Error en auto-vaciado de alforjas de compañeros: " + ex.Message)); } } } private static void OffloadCompanionSaddlebags(Player player) { List<Character> list = CompanionRuntime.Nearby(25f); if (list == null || list.Count == 0) { return; } int num = 0; HashSet<Container> hashSet = new HashSet<Container>(); HashSet<Character> hashSet2 = new HashSet<Character>(); if (s_reunirDestinosMethod != null && s_elegirDestinoMethod != null && s_moverMethod != null) { object obj = (s_reunirDestinosMethod.IsStatic ? null : s_cofreFijoInstance); if (s_reunirDestinosMethod.Invoke(obj, new object[1] { player }) is IList { Count: >0 } list2) { foreach (Character item in list) { if (!Object.op_Implicit((Object)(object)item) || !item.IsTamed()) { continue; } Inventory inventory = CompanionSaddlebags.GetInventory(item, claimOwnership: true); if (inventory == null || inventory.NrOfItems() == 0) { continue; } foreach (ItemData item2 in new List<ItemData>(inventory.GetAllItems())) { if (item2 == null || item2.m_shared == null) { continue; } int stack = item2.m_stack; object obj2 = s_elegirDestinoMethod.Invoke(null, new object[3] { list2, item2, stack }); if (obj2 == null) { continue; } object? obj3 = s_destinoInventarioField?.GetValue(obj2); Inventory val = (Inventory)((obj3 is Inventory) ? obj3 : null); object? obj4 = s_destinoCofreField?.GetValue(obj2); Container val2 = (Container)((obj4 is Container) ? obj4 : null); if (val != null && (bool)s_moverMethod.Invoke(null, new object[4] { inventory, val, item2, stack })) { num++; if ((Object)(object)val2 != (Object)null) { hashSet.Add(val2); } hashSet2.Add(item); } } } } } foreach (Container item3 in hashSet) { if (!((Object)(object)item3 != (Object)null)) { continue; } if (s_metodoGuardarCofreMethod != null) { if (s_metodoGuardarCofreMethod.IsStatic) { s_metodoGuardarCofreMethod.Invoke(null, new object[1] { item3 }); } else { s_metodoGuardarCofreMethod.Invoke(item3, null); } } else { s_containerSaveMethod?.Invoke(item3, null); } } foreach (Character item4 in hashSet2) { Container val3 = (Object.op_Implicit((Object)(object)item4) ? ((Component)item4).GetComponent<Container>() : null); if ((Object)(object)val3 != (Object)null) { s_containerSaveMethod?.Invoke(val3, null); } } if (num > 0) { string text = string.Format(ModLanguage.Text("Alforjas de compañeros: {0} objeto(s) guardado(s) en cofres."), num); ((Character)player).Message((MessageType)2, text, 0, (Sprite)null, false); TameMateRavenAdvice.TriggerAltairSynergyAdvice(); } } private static void HookRegresoAlCadaver(Harmony harmony) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown try { Type type = AccessTools.TypeByName("RegresoAlCadaver.Regreso, RegresoAlCadaver"); if (!(type == null)) { MethodInfo methodInfo = AccessTools.Method(type, "Intentar", new Type[1] { typeof(Player) }, (Type[])null); if (methodInfo != null) { MethodInfo methodInfo2 = AccessTools.Method(typeof(AltairBridge), "RegresoAlCadaver_Intentar_Postfix", (Type[])null, (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo3 = AccessTools.Method(typeof(Character), "Damage", (Type[])null, (Type[])null); if (methodInfo3 != null) { MethodInfo methodInfo4 = AccessTools.Method(typeof(AltairBridge), "Companion_Damage_Shield_Prefix", (Type[])null, (Type[])null); harmony.Patch((MethodBase)methodInfo3, new HarmonyMethod(methodInfo4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } s_regresoActive = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[AltairBridge] Mod 'RegresoAlCadaver' conectado con éxito (Rescate y Escudo Divino de Compañeros en F9)."); } } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("[AltairBridge] Error enganchando RegresoAlCadaver: " + ex.Message)); } } } private static void RegresoAlCadaver_Intentar_Postfix(Player jugador) { if (Object.op_Implicit((Object)(object)jugador)) { ((MonoBehaviour)jugador).StartCoroutine(RescueCompanionsAtCorpseRoutine(jugador)); } } private static IEnumerator RescueCompanionsAtCorpseRoutine(Player jugador) { yield return (object)new WaitForSeconds(0.4f); if (!Object.op_Implicit((Object)(object)jugador)) { yield break; } Vector3 position = ((Component)jugador).transform.position; float num = 15f; float value = Time.time + num; int num2 = 0; foreach (Character allCharacter in Character.GetAllCharacters()) { if (!Object.op_Implicit((Object)(object)allCharacter) || !allCharacter.IsTamed() || allCharacter.IsBoss()) { continue; } MonsterAI component = ((Component)allCharacter).GetComponent<MonsterAI>(); bool num3 = (Object)(object)component != (Object)null && (Object)(object)component.GetFollowTarget() == (Object)(object)((Component)jugador).gameObject; float num4 = Vector3.SqrMagnitude(((Component)allCharacter).transform.position - position); if (num3 || num4 <= 2025f) { s_companionGodShieldUntil[((Object)allCharacter).GetInstanceID()] = value; float maxHealth = allCharacter.GetMaxHealth(); if (allCharacter.GetHealth() < maxHealth * 0.35f) { allCharacter.Heal(maxHealth * 0.25f, true); } if (num4 > 144f) { Vector3 val = Random.insideUnitSphere * 3.5f; val.y = 0.2f; ((Component)allCharacter).transform.position = position + val; } num2++; } } if (num2 > 0) { ((Character)jugador).Message((MessageType)2, string.Format(ModLanguage.Text("\ud83d\udee1\ufe0f {0} compañero(s) rescatado(s) con Escudo Divino (15s)"), num2), 0, (Sprite)null, false); TameMateRavenAdvice.TriggerAltairSynergyAdvice(); } } private static bool Companion_Damage_Shield_Prefix(Character __instance, HitData hit) { if ((Object)(object)__instance == (Object)null || !__instance.IsTamed()) { return true; } int instanceID = ((Object)__instance).GetInstanceID(); if (s_companionGodShieldUntil.TryGetValue(instanceID, out var value)) { if (Time.time < value) { if (hit != null) { hit.ApplyArmor(99999f); } return false; } s_companionGodShieldUntil.Remove(instanceID); } return true; } private static void HookMesaDeTrabajo(Harmony harmony) { s_mesaActive = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[AltairBridge] Mod 'MesaDeTrabajo' conectado y armonizado."); } } private static void HookCrafteoPorTandas(Harmony harmony) { s_crafteoActive = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[AltairBridge] Mod 'CrafteoPorTandas' conectado y armonizado."); } } } internal static class BiomeProgressionGate { internal const string SupremeAntlerPickaxePrefab = "TM_PickaxeAntler_Supreme"; internal const string MasterCryptKeyPrefab = "TM_CryptKey_Master"; internal const string SupremeWishbonePrefab = "TM_Wishbone_Supreme"; internal const string SupremeDragonTearPrefab = "TM_DragonTear_Supreme"; internal const string SupremeDemisterPrefab = "TM_Demister_Supreme"; internal const string MagmaTalismanPrefab = "TM_MagmaTalisman"; internal const string PolarCrownPrefab = "TM_PolarCrown"; private static bool s_initialized; private static bool s_itemsRegistered; internal static void Init() { if (!s_initialized) { s_initialized = true; PrefabManager.OnVanillaPrefabsAvailable += RegisterProgressionItems; } } private static string FindAvailableTrophy(params string[] candidates) { if (candidates == null) { return null; } foreach (string text in candidates) { if (!string.IsNullOrEmpty(text)) { if ((Object)(object)PrefabManager.Instance.GetPrefab(text) != (Object)null) { return text; } if ((Object)(object)ZNetScene.instance != (Object)null && (Object)(object)ZNetScene.instance.GetPrefab(text) != (Object)null) { return text; } if ((Object)(object)ObjectDB.instance != (Object)null && (Object)(object)ObjectDB.instance.GetItemPrefab(text) != (Object)null) { return text; } } } return null; } private static void RegisterProgressionItems() { //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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //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_00ea: 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_00fc: 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_0110: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown //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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Expected O, but got Unknown //IL_0217: 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_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0289: 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_029f: 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_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Expected O, but got Unknown //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Expected O, but got Unknown //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Expected O, but got Unknown //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Expected O, but got Unknown //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: 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_0397: Expected O, but got Unknown //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: 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) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Expected O, but got Unknown //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Expected O, but got Unknown //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Expected O, but got Unknown //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Expected O, but got Unknown //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: 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_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Expected O, but got Unknown //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Expected O, but got Unknown //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Expected O, but got Unknown //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Expected O, but got Unknown //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_0567: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Expected O, but got Unknown //IL_05b4: 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_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05da: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05e8: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Expected O, but got Unknown //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Expected O, but got Unknown //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_0622: Unknown result type (might be due to invalid IL or missing references) //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Expected O, but got Unknown //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05a8: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Expected O, but got Unknown //IL_067c: Unknown result type (might be due to invalid IL or missing references) //IL_0681: 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_0697: Unknown result type (might be due to invalid IL or missing references) //IL_06a2: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_06b0: Unknown result type (might be due to invalid IL or missing references) //IL_06bf: Expected O, but got Unknown //IL_06cb: Unknown result type (might be due to invalid IL or missing references) //IL_06d2: Expected O, but got Unknown //IL_06e5: Unknown result type (might be due to invalid IL or missing references) //IL_06ea: Unknown result type (might be due to invalid IL or missing references) //IL_06f5: Unknown result type (might be due to invalid IL or missing references) //IL_0701: Expected O, but got Unknown //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0668: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Unknown result type (might be due to invalid IL or missing references) //IL_067c: Expected O, but got Unknown //IL_074c: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Unknown result type (might be due to invalid IL or missing references) //IL_075c: 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_0772: Unknown result type (might be due to invalid IL or missing references) //IL_0779: Unknown result type (might be due to invalid IL or missing references) //IL_0780: Unknown result type (might be due to invalid IL or missing references) //IL_078f: Expected O, but got Unknown //IL_079b: Unknown result type (might be due to invalid IL or missing references) //IL_07a2: Expected O, but got Unknown //IL_0733: Unknown result type (might be due to invalid IL or missing references) //IL_0738: Unknown result type (might be due to invalid IL or missing references) //IL_0740: Unknown result type (might be due to invalid IL or missing references) //IL_074c: Expected O, but got Unknown if (s_itemsRegistered) { return; } s_itemsRegistered = true; try { List<RequirementConfig> list = new List<RequirementConfig> { new RequirementConfig { Item = "Wood", Amount = 10 }, new RequirementConfig { Item = "HardAntler", Amount = 1 } }; string text = FindAvailableTrophy("trophy_asmodeus_TW", "TrophyAsmodeus_TW"); if (!string.IsNullOrEmpty(text)) { list.Add(new RequirementConfig { Item = text, Amount = 1 }); } _ = new string[2] { "NeckLordTrophy", "TrophyNeckLord" }; string text2 = null; if (!string.IsNullOrEmpty(text2)) { list.Add(new RequirementConfig { Item = text2, Amount = 1 }); } ItemConfig val = new ItemConfig { Name = "$tm071_text_740", Description = "$tm071_text_741", CraftingStation = CraftingStations.Workbench, MinStationLevel = 1, RequireOnlyOneIngredient = false, Requirements = list.ToArray() }; CustomItem val2 = new CustomItem("TM_PickaxeAntler_Supreme", "PickaxeAntler", val); if (Object.op_Implicit((Object)(object)val2.ItemDrop) && val2.ItemDrop.m_itemData != null && val2.ItemDrop.m_itemData.m_shared != null) { SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_damages.m_pickaxe = 28f; shared.m_damages.m_blunt = 25f; shared.m_damages.m_pierce = 25f; shared.m_maxDurability = 250f; shared.m_durabilityDrain = 0.8f; shared.m_weight = 2f; } ItemManager.Instance.AddItem(val2); List<RequirementConfig> list2 = new List<RequirementConfig> { new RequirementConfig { Item = "CryptKey", Amount = 1 } }; string text3 = FindAvailableTrophy("trophy_svalt_TW", "TrophySvalt_TW"); if (!string.IsNullOrEmpty(text3)) { list2.Add(new RequirementConfig { Item = text3, Amount = 1 }); } _ = new string[3] { "GreydwarfShamanLordTrophy", "GreydwarfLordTrophy", "TrophyGreydwarfLord" }; string text4 = null; if (!string.IsNullOrEmpty(text4)) { list2.Add(new RequirementConfig { Item = text4, Amount = 1 }); } ItemConfig val3 = new ItemConfig { Name = "$tm071_text_637", Description = "$tm071_text_638", CraftingStation = CraftingStations.Workbench, MinStationLevel = 2, RequireOnlyOneIngredient = false, Requirements = list2.ToArray() }; CustomItem val4 = new CustomItem("TM_CryptKey_Master", "CryptKey", val3); if (Object.op_Implicit((Object)(object)val4.ItemDrop) && val4.ItemDrop.m_itemData != null && val4.ItemDrop.m_itemData.m_shared != null) { val4.ItemDrop.m_itemData.m_shared.m_weight = 1f; } ItemManager.Instance.AddItem(val4); List<RequirementConfig> list3 = new List<RequirementConfig> { new RequirementConfig { Item = "Wishbone", Amount = 1 } }; string text5 = FindAvailableTrophy("trophy_vrykolathas_TW", "TrophyVrykolathas_TW"); if (!string.IsNullOrEmpty(text5)) { list3.Add(new RequirementConfig { Item = text5, Amount = 1 }); } _ = new string[3] { "DraugrEliteLordTrophy", "DraugrLordTrophy", "TrophyDraugrLord" }; string text6 = null; if (!string.IsNullOrEmpty(text6)) { list3.Add(new RequirementConfig { Item = text6, Amount = 1 }); } ItemConfig val5 = new ItemConfig { Name = "$tm071_text_721", Description = "$tm071_text_574", CraftingStation = CraftingStations.Workbench, MinStationLevel = 2, RequireOnlyOneIngredient = false, Requirements = list3.ToArray() }; CustomItem val6 = new CustomItem("TM_Wishbone_Supreme", "Wishbone", val5); ItemManager.Instance.AddItem(val6); List<RequirementConfig> list4 = new List<RequirementConfig> { new RequirementConfig { Item = "DragonTear", Amount = 2 } }; _ = new string[2] { "FenringLordTrophy", "TrophyFenringLord" }; string text7 = null; if (!string.IsNullOrEmpty(text7)) { list4.Add(new RequirementConfig { Item = text7, Amount = 1 }); } ItemConfig val7 = new ItemConfig { Name = "$tm071_text_632", Description = "$tm071_text_476", CraftingStation = CraftingStations.Workbench, MinStationLevel = 3, RequireOnlyOneIngredient = false, Requirements = list4.ToArray() }; CustomItem val8 = new CustomItem("TM_DragonTear_Supreme", "DragonTear", val7); ItemManager.Instance.AddItem(val8); List<RequirementConfig> list5 = new List<RequirementConfig> { new RequirementConfig { Item = "Demister", Amount = 1 } }; string text8 = FindAvailableTrophy("TrophySythrak_TW", "trophy_sythrak_TW"); if (!string.IsNullOrEmpty(text8)) { list5.Add(new RequirementConfig { Item = text8, Amount = 1 }); } _ = new string[2] { "LoxLordTrophy", "TrophyLoxLord" }; string text9 = null; if (!string.IsNullOrEmpty(text9)) { list5.Add(new RequirementConfig { Item = text9, Amount = 1 }); } ItemConfig val9 = new ItemConfig { Name = "$tm071_text_567", Description = "$tm071_text_549", CraftingStation = CraftingStations.Workbench, MinStationLevel = 3, RequireOnlyOneIngredient = false, Requirements = list5.ToArray() }; CustomItem val10 = new CustomItem("TM_Demister_Supreme", "Demister", val9); ItemManager.Instance.AddItem(val10); List<RequirementConfig> list6 = new List<RequirementConfig> { new RequirementConfig { Item = "QueenDrop", Amount = 1 } }; _ = new string[2] { "SeekerLordTrophy", "TrophySeekerLord" }; string text10 = null; if (!string.IsNullOrEmpty(text10)) { list6.Add(new RequirementConfig { Item = text10, Amount = 1 }); } ItemConfig val11 = new ItemConfig { Name = "$tm071_text_819", Description = "$tm071_text_444", CraftingStation = CraftingStations.Workbench, MinStationLevel = 4, RequireOnlyOneIngredient = false, Requirements = list6.ToArray() }; CustomItem val12 = new CustomItem("TM_MagmaTalisman", "QueenDrop", val11); ItemManager.Instance.AddItem(val12); List<RequirementConfig> list7 = new List<RequirementConfig> { new RequirementConfig { Item = "FaderDrop", Amount = 1 } }; _ = new string[3] { "ValkyrieLordTrophy", "FallerValkyrieLordTrophy", "TrophyFallenValkyrieLord" }; string text11 = null; if (!string.IsNullOrEmpty(text11)) { list7.Add(new RequirementConfig { Item = text11, Amount = 1 }); } ItemConfig val13 = new ItemConfig { Name = "$tm071_text_470", Description = "$tm071_text_778", CraftingStation = CraftingStations.Workbench, MinStationLevel = 4, RequireOnlyOneIngredient = false, Requirements = list7.ToArray() }; CustomItem val14 = new CustomItem("TM_PolarCrown", "FaderDrop", val13); ItemManager.Instance.AddItem(val14); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)ModLanguage.Text("TameMate: 7 ítems supremos de progresión de bioma registrados con éxito.")); } } catch (Exception arg) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogError((object)string.Format(ModLanguage.Text("TameMate: Error registrando ítems de progresión: {0}"), arg)); } } } internal static void ApplyRecipeGating(ObjectDB db) { if ((Object)(object)db == (Object)null || db.m_recipes == null) { return; } bool flag = TameMateConfig.MultiBossProgressionGate != null && TameMateConfig.MultiBossProgressionGate.Value; for (int i = 0; i < db.m_recipes.Count; i++) { Recipe val = db.m_recipes[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val.m_item == (Object)null) && ((Object)val.m_item).name == "PickaxeAntler") { val.m_enabled = true; } } } internal static bool IsSupremePickaxeEquipped(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return false; } ItemData currentWeapon = ((Humanoid)player).GetCurrentWeapon(); if (currentWeapon != null && (Object)(object)currentWeapon.m_dropPrefab != (Object)null) { return ((Object)currentWeapon.m_dropPrefab).name == "TM_PickaxeAntler_Supreme"; } return false; } internal static bool HasMasterCryptKey(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return false; } Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory != null) { return inventory.HaveItem("TM_CryptKey_Master", true); } return false; } internal static bool HasSupremeWishboneEquipped(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return false; } SEMan sEMan = ((Character)player).GetSEMan(); if (sEMan != null && sEMan.HaveStatusEffect(StringExtensionMethods.GetStableHashCode("Wishbone"))) { Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory != null) { return inventory.HaveItem("TM_Wishbone_Supreme", true); } return false; } return false; } internal static bool HasSupremeDragonTear(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return false; } Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory != null) { return inventory.HaveItem("TM_DragonTear_Supreme", true); } return false; } internal static bool HasSupremeDemisterEquipped(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return false; } SEMan sEMan = ((Character)player).GetSEMan(); if (sEMan != null && sEMan.HaveStatusEffect(StringExtensionMethods.GetStableHashCode("Demister"))) { Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory != null) { return inventory.HaveItem("TM_Demister_Supreme", true); } return false; } return false; } internal static bool HasMagmaTalisman(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return false; } Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory != null) { return inventory.HaveItem("TM_MagmaTalisman", true); } return false; } internal static bool HasPolarCrown(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return false; } Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory != null) { return inventory.HaveItem("TM_PolarCrown", true); } return false; } } [HarmonyPatch(typeof(Door), "HaveKey")] internal static class CryptGateMultiBossPatch { private static float s_lastWarnTime; [HarmonyPrefix] private static bool Prefix(Door __instance, Player player, ref bool __result) { if (!TameMateConfig.MultiBossProgressionGate.Value) { return true; } if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.m_keyItem == (Object)null || (Object)(object)player == (Object)null) { return true; } if (((Object)__instance.m_keyItem).name == "CryptKey") { Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null) { return true; } if (inventory.HaveItem("TM_CryptKey_Master", true)) { __result = true; return false; } if (inventory.HaveItem("CryptKey", true)) { if (Time.time - s_lastWarnTime > 2.5f) { s_lastWarnTime = Time.time; ((Character)player).Message((MessageType)2, ModLanguage.Text("<color=#FF5555>\ud83d\udd12 Esta reja ancestral rechaza la llave ordinaria.\nRequiere la Llave Maestra del Pantano forjada con El Sabio, Svålt y el Chamán Ancestral.</color>"), 0, (Sprite)null, false); } __result = false; return false; } } return true; } } [HarmonyPatch(typeof(ObjectDB), "Awake")] internal static class ObjectDBRecipeGateAwakePatch { [HarmonyPostfix] private static void Postfix(ObjectDB __instance) { BiomeProgressionGate.ApplyRecipeGating(__instance); } } [HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")] internal static class ObjectDBRecipeGateCopyPatch { [HarmonyPostfix] private static void Postfix(ObjectDB __instance) { BiomeProgressionGate.ApplyRecipeGating(__instance); } } [HarmonyPatch(typeof(Player), "UseStamina")] internal static class PlayerMiningStaminaPatch { [HarmonyPrefix] private static void Prefix(Player __instance, ref float v) { if (TameMateConfig.MultiBossProgressionGate.Value && Object.op_Implicit((Object)(object)__instance) && BiomeProgressionGate.IsSupremePickaxeEquipped(__instance)) { v *= 0.8f; } } } [HarmonyPatch(typeof(CharacterDrop), "GenerateDropList")] internal static class CharacterDropProgressionGatePatch { [HarmonyPostfix] private static void Postfix(CharacterDrop __instance, ref List<KeyValuePair<GameObject, int>> __result) { } } [HarmonyPatch(typeof(CharacterDrop), "DropItems")] internal static class CharacterDropDropItemsPatch { [HarmonyPrefix] private static void Prefix(ref List<KeyValuePair<GameObject, int>> drops) { } } [HarmonyPatch(typeof(MineRock5), "Damage")] internal static class MineRock5DamageProgressionPatch { private static float s_lastWarnTime; [HarmonyPrefix] private static bool Prefix(MineRock5 __instance, HitData hit) { return true; } } [HarmonyPatch(typeof(MineRock), "Damage")] internal static class MineRockDamageProgressionPatch { private static float s_lastWarnTime; [HarmonyPrefix] private static bool Prefix(MineRock __instance, HitData hit) { return true; } } [HarmonyPatch(typeof(Destructible), "Damage")] internal static class DestructibleDamageProgressionPatch { private static float s_lastWarnTime; [HarmonyPrefix] private static bool Prefix(Destructible __instance, HitData hit) { return true; } } internal sealed class BiomeBossBenchmark { public Biome Biome; public string BiomeDisplayName; public string BossName; public string DefeatedKey; public string NextBiomeName; public string TransitionDrop; public float TargetArmor; public float TargetHealth; public float TargetStamina; public float TargetEitr; public float TargetCombatSkill; public int TargetMmoLevel; public CreatureTier TargetCompanionTier; public int TargetCompanionLevel; public string RecommendedWeaponType; public string TacticalAdvice; } internal sealed class BiomeReadinessReport { public Biome Biome; public string BiomeDisplayName; public string BossName; public bool IsAscended; public int OverallScore; public string StatusRating; public string StatusColor; public float PlayerArmor; public float TargetArmor; public float ArmorScore; public float PlayerMaxHealth; public float TargetHealth; public float PlayerMaxStamina; public float TargetStamina; public float PlayerMaxEitr; public float TargetEitr; public int ActiveFoods; public float VitalityScore; public string BestCombatSkillName; public float BestCombatSkillLevel; public float TargetCombatSkill; public float SkillScore; public bool HasEpicMMO; public int PlayerMmoLevel; public int TargetMmoLevel; public float MmoScore; public Character StrongestCompanion; public CreatureTier CompanionTier; public CreatureTier TargetCompanionTier; public int CompanionLevel; public int TargetCompanionLevel; public float CompanionScore; public string NextBiomeName; public string TransitionDrop; public string TacticalAdvice; public List<string> ActionableRecommendations = new List<string>(); } internal static class BiomeReadinessEngine { private static readonly Dictionary<Biome, BiomeBossBenchmark> Benchmarks = new Dictionary<Biome, BiomeBossBenchmark> { { (Biome)1, new BiomeBossBenchmark { Biome = (Biome)1, BiomeDisplayName = ModLanguage.Text("Praderas"), BossName = "Eikthyr", DefeatedKey = "defeated_eikthyr", NextBiomeName = ModLanguage.Text("Bosque Negro"), TransitionDrop = ModLanguage.Text("Cornamenta dura (desbloquea el Pico de asta para minar Cobre y Estaño)"), TargetArmor = 12f, TargetHealth = 85f, TargetStamina = 80f, TargetEitr = 0f, TargetCombatSkill = 12f, TargetMmoLevel = 6, TargetCompanionTier = CreatureTier.Feral, TargetCompanionLevel = 3, RecommendedWeaponType = ModLanguage.Text("Arco crudo o lanza de sílex con escudo de madera"), TacticalAdvice = ModLanguage.Text("Mantén distancia con flechas durante sus descargas eléctricas y aprovecha los huecos con lanza o porra.") } }, { (Biome)8, new BiomeBossBenchmark { Biome = (Biome)8, BiomeDisplayName = ModLanguage.Text("Bosque Negro"), BossName = ModLanguage.Text("El Sabio (The Elder)"), DefeatedKey = "defeated_gdking", NextBiomeName = ModLanguage.Text("Pantano"), TransitionDrop = ModLanguage.Text("Llave del Pantano (abre Criptas Hundidas para extraer Hierro)"), TargetArmor = 32f, TargetHealth = 120f, TargetStamina = 110f, TargetEitr = 0f, TargetCombatSkill = 22f, TargetMmoLevel = 18, TargetCompanionTier = CreatureTier.Alpha, TargetCompanionLevel = 8, RecommendedWeaponType = ModLanguage.Text("Arco de madera noble con flechas de fuego, o hacha/espada de bronce"), TacticalAdvice = ModLanguage.Text("¡El Sabio es vulnerable al Fuego! Usa los pilares de piedra del altar como cobertura contra sus espinas y raíces.") } }, { (Biome)2, new BiomeBossBenchmark { Biome = (Biome)2, BiomeDisplayName = ModLanguage.Text("Pantano"), BossName = ModLanguage.Text("Masaósea (Bonemass)"), DefeatedKey = "defeated_bonemass", NextBiomeName = ModLanguage.Text("Montaña"), TransitionDrop = ModLanguage.Text("Fíbula / Horquilla de los Deseos (Wishbone para hallar vetas de Plata oculta)"), TargetArmor = 54f, TargetHealth = 145f, TargetStamina = 125f, TargetEitr = 0f, TargetCombatSkill = 32f, TargetMmoLevel = 35, TargetCompanionTier = CreatureTier.Apex, TargetCompanionLevel = 14, RecommendedWeaponType = ModLanguage.Text("Maza de hierro (Daño contundente masivo) y Escudo de hierro"), TacticalAdvice = ModLanguage.Text("¡CRÍTICO! Lleva Hidromiel de Resistencia al Veneno. Masaósea resiste corte y perforación; solo sufre con daño contundente y escarcha.") } }, { (Biome)4, new BiomeBossBenchmark { Biome = (Biome)4, BiomeDisplayName = ModLanguage.Text("Montaña"), BossName = ModLanguage.Text("Moder (Madre Dragona)"), DefeatedKey = "defeated_dragon", NextBiomeName = ModLanguage.Text("Planicies"), TransitionDrop = ModLanguage.Text("Lágrima de Dragón (Mesa de artesano: horno de fundición y telar para metal negro)"), TargetArmor = 72f, TargetHealth = 170f, TargetStamina = 140f, TargetEitr = 0f, TargetCombatSkill = 42f, TargetMmoLevel = 50, TargetCompanionTier = CreatureTier.Frostborn, TargetCompanionLevel = 20, RecommendedWeaponType = ModLanguage.Text("Arco Colmillo de Draugr con flechas de obsidiana / veneno / aguja"), TacticalAdvice = ModLanguage.Text("Capa de lobo o hidromiel anticongelante obligatoria. Esquiva su aliento de ventisca en el aire y ataca sus flancos al aterrizar.") } }, { (Biome)16, new BiomeBossBenchmark { Biome = (Biome)16, BiomeDisplayName = ModLanguage.Text("Planicies"), BossName = "Yagluth", DefeatedKey = "defeated_goblinking", NextBiomeName = ModLanguage.Text("Tierras Brumosas"), TransitionDrop = ModLanguage.Text("Espíritus Desgarrados (Fuentes de Fuegos Fatuos para disipar la niebla)"), TargetArmor = 92f, TargetHealth = 195f, TargetStamina = 155f, TargetEitr = 0f, TargetCombatSkill = 52f, TargetMmoLevel = 65, TargetCompanionTier = CreatureTier.Primal, TargetCompanionLevel = 26, RecommendedWeaponType = ModLanguage.Text("Espada de plata (daño Espíritu) o maza de metal negro"), TacticalAdvice = ModLanguage.Text("¡CRÍTICO! Vino de cebada de resistencia al fuego obligatorio. Yagluth es esquelético y vulnerable a daño de espíritu y contundente.") } }, { (Biome)512, new BiomeBossBenchmark { Biome = (Biome)512, BiomeDisplayName = ModLanguage.Text("Tierras Brumosas"), BossName = ModLanguage.Text("La Reina (The Queen)"), DefeatedKey = "defeated_queen", NextBiomeName = ModLanguage.Text("Tierras de Ceniza"), TransitionDrop = ModLanguage.Text("Caparazón Majestuoso (Maquinaria y forjas de Eitr avanzadas)"), TargetArmor = 104f, TargetHealth = 215f, TargetStamina = 170f, TargetEitr = 100f, TargetCombatSkill = 65f, TargetMmoLevel = 80, TargetCompanionTier = CreatureTier.Astral, TargetCompanionLevel = 32, RecommendedWeaponType = ModLanguage.Text("Demoledor, Gran Espada Krom, o Báculo de ascuas / escarcha"), TacticalAdvice = ModLanguage.Text("Lleva un Fuego Fatuo (Wisplight) activo. Usa armas con daño contundente de área para aniquilar los enjambres de crías.") } }, { (Biome)32, new BiomeBossBenchmark { Biome = (Biome)32, BiomeDisplayName = ModLanguage.Text("Tierras de Ceniza"), BossName = ModLanguage.Text("Fader (El Desvanecido)"), DefeatedKey = "defeated_fader", NextBiomeName = ModLanguage.Text("Norte Profundo"), TransitionDrop = ModLanguage.Text("Reliquia del Desvanecido (Fader Relic)"), TargetArmor = 120f, TargetHealth = 240f, TargetStamina = 190f, TargetEitr = 120f, TargetCombatSkill = 75f, TargetMmoLevel = 95, TargetCompanionTier = CreatureTier.Infernal, TargetCompanionLevel = 38, RecommendedWeaponType = ModLanguage.Text("Armas de flametal celestiales imbuidas de escarcha o relámpago"), TacticalAdvice = ModLanguage.Text("Protección máxima contra fuego y relámpagos. Mantente en movimiento constante para esquivar sus invocaciones de magma.") } }, { (Biome)256, new BiomeBossBenchmark { Biome = (Biome)256, BiomeDisplayName = ModLanguage.Text("Océano"), BossName = ModLanguage.Text("Serpiente Abisal"), DefeatedKey = "defeated_bonemass", NextBiomeName = ModLanguage.Text("Montaña / Alta Mar"), TransitionDrop = ModLanguage.Text("Escamas de serpiente (Escudo de escamas) y Carne de serpiente"), TargetArmor = 40f, TargetHealth = 120f, TargetStamina = 120f, TargetEitr = 0f, TargetCombatSkill = 30f, TargetMmoLevel = 30, TargetCompanionTier = CreatureTier.Alpha, TargetCompanionLevel = 10, RecommendedWeaponType = ModLanguage.Text("Arpón del Abismo con flechas de escarcha o veneno"), TacticalAdvice = ModLanguage.Text("Navega en Karve o Drakkar con buen viento. Arpona a la serpiente para remolcarla a aguas someras o a la orilla.") } } }; internal static BiomeBossBenchmark GetBenchmark(Biome biome) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) if (Benchmarks.TryGetValue(biome, out var value)) { return value; } return Benchmarks[(Biome)1]; } private static bool IsCombatSkill(SkillType skillType) { //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_0040: Expected I4, but got Unknown //IL_0040: 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_0045: Invalid comparison between Unknown and I4 //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Invalid comparison between Unknown and I4 switch (skillType - 1) { default: if (skillType - 100 > 4 && (int)skillType != 110) { return true; } goto case 11; case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 13: return true; case 11: case 12: return false; } } private static string GetSkillDisplayName(Skill skill) { if (skill == null || skill.m_info == null) { return ModLanguage.Text("Combate"); } string text = ((object)Unsafe.As<SkillType, SkillType>(ref skill.m_info.m_skill)/*cast due to .constrained prefix*/).ToString(); string text2 = ((Localization.instance != null) ? Localization.instance.Localize("$skill_" + text.ToLowerInvariant()) : text); if (string.IsNullOrEmpty(text2) || text2.StartsWith("$")) { return text; } return text2; } internal static BiomeReadinessReport Evaluate(Player player) { //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_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_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_022e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)player)) { return null; } Biome biomeAt = SupremeTierEngine.GetBiomeAt(((Component)player).transform.position); BiomeBossBenchmark benchmark = GetBenchmark(biomeAt); bool flag = SupremeTierEngine.IsBiomeAscended(biomeAt); BiomeReadinessReport biomeReadinessReport = new BiomeReadinessReport { Biome = biomeAt, BiomeDisplayName = benchmark.BiomeDisplayName, BossName = benchmark.BossName, IsAscended = flag, NextBiomeName = benchmark.NextBiomeName, TransitionDrop = benchmark.TransitionDrop, TacticalAdvice = benchmark.TacticalAdvice, TargetArmor = benchmark.TargetArmor, TargetHealth = benchmark.TargetHealth, TargetStamina = benchmark.TargetStamina, TargetEitr = benchmark.TargetEitr, TargetCombatSkill = benchmark.TargetCombatSkill, TargetMmoLevel = benchmark.TargetMmoLevel, TargetCompanionTier = benchmark.TargetCompanionTier, TargetCompanionLevel = benchmark.TargetCompanionLevel }; biomeReadinessReport.PlayerArmor = ((Character)player).GetBodyArmor(); float num = Mathf.Clamp01(biomeReadinessReport.PlayerArmor / Mathf.Max(1f, benchmark.TargetArmor)); biomeReadinessReport.ArmorScore = num * 25f; biomeReadinessReport.PlayerMaxHealth = ((Character)player).GetMaxHealth(); biomeReadinessReport.PlayerMaxStamina = ((Character)player).GetMaxStamina(); biomeReadinessReport.PlayerMaxEitr = ((Character)player).GetMaxEitr(); biomeReadinessReport.ActiveFoods = player.GetFoods()?.Count ?? 0; float num2 = Mathf.Clamp01(biomeReadinessReport.PlayerMaxHealth / Mathf.Max(1f, benchmark.TargetHealth)); float num3 = Mathf.Clamp01(biomeReadinessReport.PlayerMaxStamina / Mathf.Max(1f, benchmark.TargetStamina)); float num4 = Mathf.Clamp01((float)biomeReadinessReport.ActiveFoods / 3f); biomeReadinessReport.VitalityScore = num2 * 10f + num3 * 5f + num4 * 5f; float num5 = 0f; string bestCombatSkillName = "Armas"; Skills skills = ((Character)player).GetSkills(); if ((Object)(object)skills != (Object)null) { List<Skill> skillList = skills.GetSkillList(); if (skillList != null) { foreach (Skill item in skillList) { if (item != null && item.m_info != null && IsCombatSkill(item.m_info.m_skill) && item.m_level > num5) { num5 = item.m_level; bestCombatSkillName = GetSkillDisplayName(item); } } } } biomeReadinessReport.BestCombatSkillLevel = num5; biomeReadinessReport.BestCombatSkillName = bestCombatSkillName; float num6 = Mathf.Clamp01(num5 / Mathf.Max(1f, benchmark.TargetCombatSkill)); biomeReadinessReport.SkillScore = num6 * 20f; biomeReadinessReport.HasEpicMMO = EpicMMOBridge.IsInstalled; if (biomeReadinessReport.HasEpicMMO) { biomeReadinessReport.PlayerMmoLevel = EpicMMOBridge.PlayerLevel; float num7 = Mathf.Clamp01((float)biomeReadinessReport.PlayerMmoLevel / (float)Mathf.Max(1, benchmark.TargetMmoLevel)); biomeReadinessReport.MmoScore = num7 * 15f; } else { biomeReadinessReport.ArmorScore += num * 8f; biomeReadinessReport.SkillScore += num6 * 7f; biomeReadinessReport.MmoScore = 0f; } Character val = null; CreatureTier creatureTier = CreatureTier.Feral; int num8 = 0; long playerID = player.GetPlayerID(); foreach (Character item2 in CompanionRuntime.Nearby(35f)) { if (!Object.op_Implicit((Object)(object)item2) || !item2.IsTamed()) { continue; } long num9 = CompanionState.Owner(item2); if (num9 == playerID || num9 == 0L) { CreatureTier tier = SupremeTierEngine.GetTier(item2); int num10 = CompanionState.Level(item2); if ((Object)(object)val == (Object)null || tier > creatureTier || (tier == creatureTier && num10 > num8)) { val = item2; creatureTier = tier; num8 = num10; } } } biomeReadinessReport.StrongestCompanion = val; biomeReadinessReport.CompanionTier = creatureTier; biomeReadinessReport.CompanionLevel = num8; if ((Object)(object)val != (Object)null) { float num11 = Mathf.Clamp01((float)creatureTier / (float)benchmark.TargetCompanionTier); float num12 = Mathf.Clamp01((float)num8 / (float)Mathf.Max(1, benchmark.TargetCompanionLevel)); biomeReadinessReport.CompanionScore = num11 * 12f + num12 * 8f; } else { biomeReadinessReport.CompanionScore = 0f; } if (flag) { biomeReadinessReport.OverallScore = 100; biomeReadinessReport.StatusRating = ModLanguage.Text("BIOMA ASCENDIDO (Superado)"); biomeReadinessReport.StatusColor = "#55FF55"; } else { float num13 = biomeReadinessReport.ArmorScore + biomeReadinessReport.VitalityScore + biomeReadinessReport.SkillScore + biomeReadinessReport.MmoScore + biomeReadinessReport.CompanionScore; biomeReadinessReport.OverallScore = Mathf.Clamp(Mathf.RoundToInt(num13), 0, 100); if (biomeReadinessReport.OverallScore >= 85) { biomeReadinessReport.StatusRating = ModLanguage.Text("¡LISTO PARA EL COMBATE!"); biomeReadinessReport.StatusColor = "#00FFAA"; } else if (biomeReadinessReport.OverallScore >= 65) { biomeReadinessReport.StatusRating = ModLanguage.Text("PREPARACIÓN ACEPTABLE"); biomeReadinessReport.StatusColor = "#E8C673"; } else if (biomeReadinessReport.OverallScore >= 45) { biomeReadinessReport.StatusRating = ModLanguage.Text("PREPARACIÓN REGULAR (Riesgo)"); biomeReadinessReport.StatusColor = "#FFA050"; } else { biomeReadinessReport.StatusRating = ModLanguage.Text("NO PREPARADO (Mortal)"); biomeReadinessReport.StatusColor = "#FF4444"; } } GenerateRecommendations(biomeReadinessReport, benchmark); return biomeReadinessReport; } private static void GenerateRecommendations(BiomeReadinessReport report, BiomeBossBenchmark b) { if (report.IsAscended) { report.ActionableRecommendations.Add(ModLanguage.Text("Has vencido a ") + b.BossName + ModLanguage.Text(". Estás capacitado para avanzar a: ") + b.NextBiomeName + "."); report.ActionableRecommendations.Add(ModLanguage.Text("Recompensa obtenida: ") + b.TransitionDrop + "."); return; } if (report.PlayerArmor < b.TargetArmor * 0.9f) { report.ActionableRecommendations.Add(string.Format(ModLanguage.Text("\ud83d\udee1\ufe0f Armadura insuficiente: Tienes {0:F0}, se recomienda {1:F0} (Forja o sube de nivel la armadura de {2})."), report.PlayerArmor, b.TargetArmor, b.BiomeDisplayName)); } if (report.ActiveFoods < 3) { report.ActionableRecommendations.Add(string.Format(ModLanguage.Text("\ud83c\udf56 Comidas activas: Tienes {0}/3. ¡Nunca invoques al jefe con el estómago vacío! Come 3 platos cocinados."), report.ActiveFoods)); } else if (report.PlayerMaxHealth < b.TargetHealth * 0.9f) { report.ActionableRecommendations.Add(string.Format(ModLanguage.Text("❤\ufe0f Salud baja: Tienes {0:F0} HP (Recomendado {1:F0} HP). Cocina recetas avanzadas en el caldero."), report.PlayerMaxHealth, b.TargetHealth)); } if (report.BestCombatSkillLevel < b.TargetCombatSkill * 0.85f) { report.ActionableRecommendations.Add(string.Format(ModLanguage.Text("⚔\ufe0f Destreza baja: Tu mejor maestría es {0} ({1:F0}), recomendada nivel {2:F0}."), report.BestCombatSkillName, report.BestCombatSkillLevel, b.TargetCombatSkill)); } if (report.HasEpicMMO && report.PlayerMmoLevel < b.TargetMmoLevel) { report.ActionableRecommendations.Add(string.Format(ModLanguage.Text("⭐ Nivel MMO bajo: Eres Nv. {0} (Recomendado Nv. {1}). Caza enemigos en {2} para subir atributos."), report.PlayerMmoLevel, b.TargetMmoLevel, b.BiomeDisplayName)); } if ((Object)(object)report.StrongestCompanion == (Object)null) { report.ActionableRecommendations.Add(string.Format(ModLanguage.Text("\ud83d\udc3e Sin compañero bestia: Doma y lleva un compañero Tier {0} para absorber daño y recibir bonificaciones de combate."), b.TargetCompanionTier)); } else if (report.CompanionTier < b.TargetCompanionTier) { report.ActionableRecommendations.Add(string.Format(ModLanguage.Text("\ud83d\udc3a Compañero débil: {0} es Tier {1}. Se aconseja Tier {2} ({3})."), report.StrongestCompanion.GetHoverName(), report.CompanionTier, b.TargetCompanionTier, b.BiomeDisplayName)); } else if (report.CompanionLevel < b.TargetCompanionLevel) { report.ActionableRecommendations.Add(string.Format(ModLanguage.Text("\ud83d\udcc8 Sube de nivel a tu compañero: Tiene Nv. {0} (Recomendado Nv. {1}+). Entrénalo cazando."), report.CompanionLevel, b.TargetCompanionLevel)); } report.ActionableRecommendations.Add(ModLanguage.Text("\ud83d\udca1 Consejo de Batalla: ") + b.TacticalAdvice); report.ActionableRecommendations.Add(ModLanguage.Text("\ud83c\udfc6 Recompensa clave: ") + b.TransitionDrop); } internal static void ShowReadinessHud(Player player) { BiomeReadinessReport biomeReadinessReport = Evaluate(player); if (biomeReadinessReport != null) { string text = string.Format(ModLanguage.Text("<color={0}>[TameMate] Preparación {1} vs {2}: {3}% ({4})</color>"), biomeReadinessReport.StatusColor, biomeReadinessReport.BiomeDisplayName, biomeReadinessReport.BossName, biomeReadinessReport.OverallScore, biomeReadinessReport.StatusRating); string text2 = ((biomeReadinessReport.ActionableRecommendations.Count > 0) ? biomeReadinessReport.ActionableRecommendations[0] : ""); string text3 = text + "\n" + text2 + ModLanguage.Text("\n<color=#A0FFA0>Usa consola 'tm readiness' para ver el informe completo.</color>"); if (Object.op_Implicit((Object)(object)player)) { ((Character)player).Message((MessageType)2, text3, 0, (Sprite)null, false); } } } internal static void PrintConsoleReport(Player player) { //IL_0316: 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_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_046c: 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_0510: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Unknown result type (might be due to invalid IL or missing references) BiomeReadinessReport biomeReadinessReport = Evaluate(player); if (biomeReadinessReport == null) { return; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("================================================================================"); stringBuilder.AppendLine(ModLanguage.Text(" [TAMEMATE] REPORTE DE PREPARACIÓN DE BIOMA Y PROGRESIÓN")); stringBuilder.AppendLine("================================================================================"); stringBuilder.AppendLine(ModLanguage.Text(" Bioma Actual: ") + biomeReadinessReport.BiomeDisplayName + ModLanguage.Text(" | Jefe del Bioma: ") + biomeReadinessReport.BossName); stringBuilder.AppendLine(ModLanguage.Text(" Estado: ") + (biomeReadinessReport.IsAscended ? ModLanguage.Text("SUPERADO / ASCENDIDO") : ModLanguage.Text("PENDIENTE"))); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" Índice de Preparación General: {0}% [{1}]"), biomeReadinessReport.OverallScore, biomeReadinessReport.StatusRating)); stringBuilder.AppendLine("--------------------------------------------------------------------------------"); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" 1. Armadura y Equipo: {0:F0} / {1:F0} objetivo (Puntaje: {2:F1}/25)"), biomeReadinessReport.PlayerArmor, biomeReadinessReport.TargetArmor, biomeReadinessReport.ArmorScore)); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" 2. Vitalidad y Nutrición: {0:F0} HP / {1:F0} obj. | {2:F0} Aguante | {3}/3 comidas (Puntaje: {4:F1}/20)"), biomeReadinessReport.PlayerMaxHealth, biomeReadinessReport.TargetHealth, biomeReadinessReport.PlayerMaxStamina, biomeReadinessReport.ActiveFoods, biomeReadinessReport.VitalityScore)); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" 3. Destreza de Armas: {0} Nv. {1:F0} / {2:F0} obj. (Puntaje: {3:F1}/20)"), biomeReadinessReport.BestCombatSkillName, biomeReadinessReport.BestCombatSkillLevel, biomeReadinessReport.TargetCombatSkill, biomeReadinessReport.SkillScore)); if (biomeReadinessReport.HasEpicMMO) { stringBuilder.AppendLine(string.Format(ModLanguage.Text(" 4. Nivel y Stats MMO: Nivel {0} / {1} obj. (Puntaje: {2:F1}/15)"), biomeReadinessReport.PlayerMmoLevel, biomeReadinessReport.TargetMmoLevel, biomeReadinessReport.MmoScore)); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" Sinergias Bestia: +{0}% Daño | +{1}% Defensa"), Mathf.RoundToInt(EpicMMOBridge.CompanionPhysicalDamageBonus * 100f), Mathf.RoundToInt(EpicMMOBridge.CompanionDefenseBonus * 100f))); } else { stringBuilder.AppendLine(ModLanguage.Text(" 4. Nivel y Stats MMO: [EpicMMO no instalado - bonos compensados en Equipo y Habilidades]")); } if ((Object)(object)biomeReadinessReport.StrongestCompanion != (Object)null) { stringBuilder.AppendLine(string.Format(ModLanguage.Text(" 5. Compañero Activo: {0} (Tier {1}, Nv. {2}) / Obj: Tier {3} Nv. {4} (Puntaje: {5:F1}/20)"), biomeReadinessReport.StrongestCompanion.GetHoverName(), biomeReadinessReport.CompanionTier, biomeReadinessReport.CompanionLevel, biomeReadinessReport.TargetCompanionTier, biomeReadinessReport.TargetCompanionLevel, biomeReadinessReport.CompanionScore)); } else { stringBuilder.AppendLine(ModLanguage.Text(" 5. Compañero Activo: Ninguno cerca (Puntaje: 0/20) - [Se recomienda domesticar una bestia]")); } stringBuilder.AppendLine("--------------------------------------------------------------------------------"); stringBuilder.AppendLine(ModLanguage.Text(" HABILIDADES NATIVAS NÓRDICAS (12 Árboles):")); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" • Vínculo de Manada: Nv. {0:F0} (+{1}% Vel. Bestia, -{2}% Aguante Monta)"), SkillsEngine.GetLevel(player, SkillsEngine.PackMastery), Mathf.RoundToInt((SkillsEngine.GetPackSpeedMultiplier(player) - 1f) * 100f), Mathf.RoundToInt(SkillsEngine.GetRidingStaminaDiscount(player) * 100f))); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" • Artes Viscerales: Nv. {0:F0} (Ventana Riposte {1:F1}s, +{2:F0} Aguante Esquiva)"), SkillsEngine.GetLevel(player, SkillsEngine.VisceralArts), SkillsEngine.GetVisceralWindow(player), SkillsEngine.GetDodgeStamina(player))); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" • Susurro Ultratumba: Nv. {0:F0} (Robo de Vida {1}%, Toppings {2}m)"), SkillsEngine.GetLevel(player, SkillsEngine.NecroticLore), Mathf.RoundToInt(SkillsEngine.GetLifeLeechRatio(player) * 100f), Mathf.RoundToInt(SkillsEngine.GetUndeadBuffDuration(player) / 60f))); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" • Ojo Cazador Apex: Nv. {0:F0} (Suelo Daño {1}%, Sobrecarga {2}%)"), SkillsEngine.GetLevel(player, SkillsEngine.ApexInstinct), Mathf.RoundToInt(SkillsEngine.GetMinDamageFloorPercent(player, 0.25f) * 100f), Mathf.RoundToInt(SkillsEngine.GetElementalOverloadMultiplier(player) * 100f))); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" • Temple Primal: Nv. {0:F0} (Mitigación Asedio -{1}%, Nutrición +{2}%)"), SkillsEngine.GetLevel(player, SkillsEngine.PrimalResilience), Mathf.RoundToInt(SkillsEngine.GetBloodMoonDamageReduction(player) * 100f), Mathf.RoundToInt(SkillsEngine.GetFoodNutrientBonus(player) * 100f))); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" • Artes Culinarias: Nv. {0:F0} (Duración Comida +{1}%, Nutrición +{2}%)"), SkillsEngine.GetLevel(player, SkillsEngine.CulinaryArts), Mathf.RoundToInt(SkillsEngine.GetCulinaryDurationBonus(player) * 100f), Mathf.RoundToInt(SkillsEngine.GetCulinaryStatBonus(player) * 100f))); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" • Maestría del Hogar: Nv. {0:F0} (Doble Cosecha {1}%, Descanso +{2}m)"), SkillsEngine.GetLevel(player, SkillsEngine.HomesteadMastery), Mathf.RoundToInt(SkillsEngine.GetHomesteadHarvestBonusChance(player) * 100f), Mathf.RoundToInt(SkillsEngine.GetHomesteadRestedBonusSeconds(player) / 60f))); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" • Herrería y Forja: Nv. {0:F0} (Durabilidad Equipo +{1}%)"), SkillsEngine.GetLevel(player, SkillsEngine.Crafting), Mathf.RoundToInt((SkillsEngine.GetCraftingDurabilityMultiplier(player) - 1f) * 100f))); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" • Navegación Nórdica: Nv. {0:F0} (Velocidad Barco +{1}%)"), SkillsEngine.GetLevel(player, SkillsEngine.Sailing), Mathf.RoundToInt((SkillsEngine.GetSailingSpeedMultiplier(player) - 1f) * 100f))); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" • Poder Primitivo: Nv. {0:F0} (Peso Máximo +{1}kg, Empuje +{2}%)"), SkillsEngine.GetLevel(player, SkillsEngine.Strength), Mathf.RoundToInt(SkillsEngine.GetStrengthWeightBonus(player)), Mathf.RoundToInt(SkillsEngine.GetStrengthPushBonus(player) * 100f))); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" • Vitalidad Vikinga: Nv. {0:F0} (Salud Máx. +{1} HP, Regen. +{2}%)"), SkillsEngine.GetLevel(player, SkillsEngine.Vitality), Mathf.RoundToInt(SkillsEngine.GetVitalityHealthBonus(player)), Mathf.RoundToInt(SkillsEngine.GetVitalityRegenBonus(player) * 100f))); stringBuilder.AppendLine(string.Format(ModLanguage.Text(" • Caza Ancestral: Nv. {0:F0} (Botín Fauna +{1}%, Trofeos +{2}%)"), SkillsEngine.GetLevel(player, SkillsEngine.Hunting), Mathf.RoundToInt((SkillsEngine.GetHuntingLootMultiplier(player) - 1f) * 100f), Mathf.RoundToInt(SkillsEngine.GetHuntingTrophyBonusChance(player) * 100f))); stringBuilder.AppendLine("--------------------------------------------------------------------------------"); stringBuilder.AppendLine(ModLanguage.Text(" RECOMENDACIONES TÁCTICAS PARA AVANZAR:")); foreach (string actionableRecommendation in biomeReadinessReport.ActionableRecommendations) { stringBuilder.AppendLine(" • " + actionableRecommendation); } stringBuilder.AppendLine("================================================================================"); string text = stringBuilder.ToString(); if (Object.op_Implicit((Object)(object)Console.instance)) { Console.instance.Print(text); } Plugin.Log.LogInfo((object)text); } internal static string GetReadinessShortSummary() { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return ModLanguage.Text("Preparación: --"); } BiomeReadinessReport biomeReadinessReport = Evaluate(Player.m_localPlayer); if (biomeReadinessReport == null) { return ModLanguage.Text("Preparación: --"); } return string.Format(ModLanguage.Text("Preparación {0}: <color={1}>{2}%</color>"), biomeReadinessReport.BossName, biomeReadinessReport.StatusColor, biomeReadinessReport.OverallScore); } internal static string GetAltarHoverText(Biome biome) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return ""; } BiomeBossBenchmark benchmark = GetBenchmark(biome); BiomeReadinessReport biomeReadinessReport = Evaluate(Player.m_localPlayer); if (biomeReadinessReport == null) { return ""; } return string.Format(ModLanguage.Text("\n<color={0}>[TameMate] Preparación para {1}: {2}% ({3})</color>"), biomeReadinessReport.StatusColor, benchmark.BossName, biomeReadinessReport.OverallScore, biomeReadinessReport.StatusRating) + ModLanguage.Text("\n<color=#A0FFA0>[F8] o 'tm readiness' para ver recomendaciones.</color>"); } } internal sealed class BloodMoonManager : MonoBehaviour { private static EnvSetup bloodMoonEnv; private static float nextCheck; private static bool announcedStart; private static bool announcedEnd; internal static BloodMoonManager Instance { get; private set; } internal static bool IsActive { get; private set; } internal static bool ForceActive { get; set; } private void Awake() { Instance = this; } private void OnDestroy() { if (IsActive) { StopBloodMoon(announce: false); } Instance = null; } private void Update() { if (Time.time < nextCheck) { return; } nextCheck = Time.time + 1f; if ((Object)(object)ZNet.instance == (Object)null || (Object)(object)EnvMan.instance == (Object)null) { return; } EnsureEnvironment(); int day = EnvMan.instance.GetDay(); bool flag = EnvMan.IsNight(); int num = Mathf.Max(1, TameMateConfig.BloodMoonIntervalDays?.Value ?? 5); bool flag2 = day > 0 && day % num == 0 && flag; ConfigEntry<bool> bloodMoonEnabled = TameMateConfig.BloodMoonEnabled; bool flag3 = (bloodMoonEnabled == null || bloodMoonEnabled.Value) && (flag2 || ForceActive); if (ZNet.instance.IsServer() && (Object)(object)ZoneSystem.instance != (Object)null) { bool globalKey = ZoneSystem.instance.GetGlobalKey("BloodMoon"); if (flag3 && !globalKey) { ZoneSystem.instance.SetGlobalKey("BloodMoon"); } else if (!flag3 && globalKey) { ZoneSystem.instance.RemoveGlobalKey("BloodMoon"); } } bool flag4 = ((Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.GetGlobalKey("BloodMoon")) || flag3; if (flag4 && !IsActive) { StartBloodMoon(announce: true); } else if (!flag4 && IsActive) { StopBloodMoon(announce: true); } } private static void EnsureEnvironment() { //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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0187: 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) if (bloodMoonEnv != null || (Object)(object)EnvMan.instance == (Object)null) { return; } try { EnvSetup val = EnvMan.instance.GetCurrentEnvironment() ?? ((EnvMan.instance.m_environments != null && EnvMan.instance.m_environments.Count > 0) ? EnvMan.instance.m_environments[0] : null); if (val != null) { bloodMoonEnv = val.Clone(); bloodMoonEnv.m_name = "BloodMoon"; bloodMoonEnv.m_alwaysDark = false; bloodMoonEnv.m_isWet = false; bloodMoonEnv.m_isFreezing = false; bloodMoonEnv.m_isFreezingAtNight = false; bloodMoonEnv.m_isColdAtNight = true; bloodMoonEnv.m_sunColorNight = new Color(0.98f, 0.05f, 0.04f, 1f); bloodMoonEnv.m_lightIntensityNight = 1.35f; bloodMoonEnv.m_fogColorNight = new Color(0.35f, 0.035f, 0.035f, 1f); bloodMoonEnv.m_fogColorSunNight = new Color(0.98f, 0.1f, 0.05f, 1f); bloodMoonEnv.m_fogDensityNight = 0.038f; bloodMoonEnv.m_ambColorNight = new Color(0.14f, 0.02f, 0.02f, 1f); bloodMoonEnv.m_ambientOcclusionColor = new Color(0.04f, 0.005f, 0.005f, 1f); bloodMoonEnv.m_cloudOpacityNight = 0.9f; EnvMan.instance.AppendEnvironment(bloodMoonEnv); } } catch { } } private static void StartBloodMoon(bool announce) { IsActive = true; GuideEvents.BloodMoon(true, announce); EnsureEnvironment(); try { if ((Object)(object)EnvMan.instance != (Object)null) { EnvMan.instance.SetForceEnvironment("BloodMoon"); } } catch { } if (!announce || announcedStart) { return; } announcedStart = true; announcedEnd = false; try { if ((Object)(object)MessageHud.instance != (Object)null && (Object)(object)Player.m_localPlayer != (Object)null) { MessageHud.instance.ShowBiomeFoundMsg(ModLanguage.Text("¡LA LUNA DE SANGRE SE ALZA!"), true); } } catch { } } private static void StopBloodMoon(bool announce) { IsActive = false; GuideEvents.BloodMoon(false, announce); try { if ((Object)(object)EnvMan.instance != (Object)null) { EnvMan.instance.SetForceEnvironment(""); } } catch { } if (!announce || announcedEnd) { return; } announcedEnd = true; announcedStart = false; try { if ((Object)(object)MessageHud.instance != (Object)null && (Object)(object)Player.m_localPlayer != (Object)null) { MessageHud.instance.ShowMessage((MessageType)2, ModLanguage.Text("<color=#ffcccc>El amanecer disipa la Luna de Sangre...</color>"), 0, (Sprite)null, false, true); } } catch { } } } [HarmonyPatch(typeof(EnvMan), "SetEnv")] internal static class BloodMoonSetEnvPatch { private static void Postfix(EnvMan __instance) { //IL_0046: 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_00b7: 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_00e5: 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) if (BloodMoonManager.IsActive && !((Object)(object)__instance == (Object)null)) { Color val = default(Color); ((Color)(ref val))..ctor(0.98f, 0.05f, 0.04f, 1f); Color fogColor = new Color(0.35f, 0.035f, 0.035f, 1f); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.14f, 0.02f, 0.02f, 1f); if ((Object)(object)__instance.m_dirLight != (Object)null) { __instance.m_dirLight.color = val; __instance.m_dirLight.intensity = 1.35f; } RenderSettings.fogColor = fogColor; RenderSettings.fogDensity = Mathf.Max(RenderSettings.fogDensity, 0.035f); RenderSettings.ambientLight = val2; Shader.SetGlobalColor("_SunColor", val); Shader.SetGlobalColor("_SunFogColor", new Color(0.98f, 0.1f, 0.05f, 1f)); Shader.SetGlobalColor("_AmbientColor", val2); } } } [HarmonyPatch(typeof(EnvMan), "CanSleep")] internal static class BloodMoonCanSleepPatch { private static void Postfix(ref bool __result) { if (BloodMoonManager.IsActive) { __result = false; } } } [HarmonyPatch(typeof(SpawnSystem), "UpdateSpawnList")] internal static class BloodMoonSpawnPatch { private struct SpawnerBackup { public SpawnData data; public float origChance; public float origInterval; public int origMax; } private static readonly List<SpawnerBackup> backups = new List<SpawnerBackup>(); private static void Prefix(List<SpawnData> spawners) { } private static void Postfix() { } } [HarmonyPatch(typeof(Character), "Damage")] internal static class BloodMoonDamagePatch { [HarmonyPriority(800)] private static void Prefix(Character __instance, HitData hit) { if (!BloodMoonManager.IsActive || hit == null) { return; } Character attacker = hit.GetAttacker(); if ((Object)(object)attacker != (Object)null && !attacker.IsTamed() && !attacker.IsPlayer()) { float num = Mathf.Clamp(TameMateConfig.BloodMoonDamageMultiplier?.Value ?? 1.4f, 1f, 3f); if (num > 1.01f) { hit.ApplyModifier(num); } } } } [HarmonyPatch(typeof(Character), "GetRunSpeedFactor")] internal static class BloodMoonRunSpeedPatch { private static void Postfix(Character __instance, ref float __result) { if (BloodMoonManager.IsActive && (Object)(object)__instance != (Object)null && !__instance.IsTamed() && !__instance.IsPlayer()) { float num = Mathf.Clamp(TameMateConfig.BloodMoonSpeedMultiplier?.Value ?? 1.25f, 1f, 2f); __result *= num; } } } [HarmonyPatch(typeof(Character), "GetJogSpeedFactor")] internal static class BloodMoonJogSpeedPatch { private static void Postfix(Character __instance, ref float __result) { if (BloodMoonManager.IsActive && (Object)(object)__instance != (Object)null && !__instance.IsTamed() && !__instance.IsPlayer()) { float num = Mathf.Clamp(TameMateConfig.BloodMoonSpeedMultiplier?.Value ?? 1.25f, 1f, 2f); __result *= num; } } } public static class BossPassiveEngine { public struct PlayerCombatProfile { public float FireRatio; public float FaderPhysicalMultiplier; public float ElderChopMultiplier; public float QueenMiningMultiplier; public float OceanCombatMultiplier; public float ModerProjectileMultiplier; public float LoxBluntMultiplier; public float ValkAerialMultiplier; public float FenringBackstabBonus; public float AsmodeusPoisonBonus; public float SvaltBerserkerMaxBonus; public float SythrakLightningBonus; public float DraugrLifestealRatio; public float BonemassPhysicalMitigation; public float BonemassPoisonResistance; public bool IsAsmodeusPoisonImmune; public float YagluthElementalMitigation; public float ValkFireMitigation; public float SythrakLightningMitigation; public float DeepNorthFrostMitigation; public float DeepNorthArmorBonus; public float LoxArmorBonus; public float DraugrArmorBonus; public float FenringFallDiscount; public float SeekerThornsRatio; } public const string KeyEikthyr = "Eikthyr"; public const string KeyElder = "TheElder"; public const string KeyBonemass = "Bonemass"; public const string KeyModer = "Moder"; public const string KeyYagluth = "Yagluth"; public const string KeyQueen = "Queen"; public const string KeyFader = "Fader"; public const string KeyOcean = "Ocean"; public const string KeyNeckLord = "NeckLord"; public const string KeyGreydwarfLord = "GreydwarfLord"; public const string KeyDraugrLord = "DraugrLord"; public const string KeyFenringLord = "FenringLord"; public const string KeyLoxLord = "LoxLord"; public const string KeySeekerLord = "SeekerLord"; public const string KeyValkyrieLord = "ValkyrieLord"; public const string KeyDeepNorth = "DeepNorth"; public const string KeyAsmodeus = "Asmodeus"; public const string KeySvalt = "Svalt"; public const string KeyVrykolathas = "Vrykolathas"; public const string KeySythrak = "Sythrak"; public static readonly string[] AllBossKeys = new string[20] { "Eikthyr", "TheElder", "Bonemass", "Moder", "Yagluth", "Queen", "Fader", "Ocean", "NeckLord", "GreydwarfLord", "DraugrLord", "FenringLord", "LoxLord", "SeekerLord", "ValkyrieLord", "DeepNorth", "Asmodeus", "Svalt", "Vrykolathas", "Sythrak" }; private static readonly Dictionary<string, string> PowerToKey = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "GP_Eikthyr", "Eikthyr" }, { "Eikthyr", "Eikthyr" }, { "GP_TheElder", "TheElder" }, { "TheElder", "TheElder" }, { "gd_king", "TheElder" }, { "GP_Bonemass", "Bonemass" }, { "Bonemass", "Bonemass" }, { "GP_Moder", "Moder" }, { "Moder", "Moder" }, { "DragonQueen", "Moder" }, { "GP_Yagluth", "Yagluth" }, { "Yagluth", "Yagluth" }, { "GoblinKing", "Yagluth" }, { "GP_Queen", "Queen" }, { "Queen", "Queen" }, { "SeekerQueen", "Queen" }, { "GP_Fader", "Fader" }, { "Fader", "Fader" }, { "GP_OceanBoss", "Ocean" }, { "TM_OceanBoss", "Ocean" }, { "Ocean", "Ocean" }, { "Jormungandr", "Ocean" }, { "GP_NeckLord", "NeckLord" }, { "NeckLordGP", "NeckLord" }, { "NeckLord", "NeckLord" }, { "BuildNeckLord", "NeckLord" }, { "GP_GreydwarfLord", "GreydwarfLord" }, { "GreydwarfLordGP", "GreydwarfLord" }, { "GreydwarfLord", "GreydwarfLord" }, { "GreydwarfShamanLord", "GreydwarfLord" }, { "GP_DraugrLord", "DraugrLord" }, { "DraugrLordGP", "DraugrLord" }, { "DraugrLord", "DraugrLord" }, { "DraugrEliteLord", "DraugrLord" }, { "GP_FenringLord", "FenringLord" }, { "FenringLordGP", "FenringLord" }, { "FenringLord", "FenringLord" }, { "GP_LoxLord", "LoxLord" }, { "LoxLordGP", "LoxLord" }, { "LoxLord", "LoxLord" }, { "GP_SeekerLord", "SeekerLord" }, { "SeekerLordGP", "SeekerLord" }, { "SeekerLord", "SeekerLord" }, { "GP_ValkyrieLord", "ValkyrieLord" }, { "ValkyrieLordGP", "ValkyrieLord" }, { "ValkyrieLord", "ValkyrieLord" }, { "FallerValkyrieLord", "ValkyrieLord" }, { "GP_GammeltrollLord", "DeepNorth" }, { "GammeltrollLordGP", "DeepNorth" }, { "GammeltrollLord", "DeepNorth" }, { "gammeltroll_lord", "DeepNorth" }, { "DeepNorth", "DeepNorth" }, { "Asmodeus", "Asmodeus" }, { "trophy_asmodeus_TW", "Asmodeus" }, { "Svalt", "Svalt" }, { "trophy_svalt_TW", "Svalt" }, { "Vrykolathas", "Vrykolathas" }, { "trophy_vrykolathas_TW", "Vrykolathas" }, { "Sythrak", "Sythrak" }, { "trophy_sythrak_TW", "Sythrak" } }; private static readonly Dictionary<string, string[]> KeyToTrophies = new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase) { { "Eikthyr", new string[1] { "TrophyEikthyr" } }, { "TheElder", new string[1] { "TrophyTheElder" } }, { "Bonemass", new string[1] { "TrophyBonemass" } }, { "Moder", new string[1] { "TrophyDragonQueen" } }, { "Yagluth", new string[1] { "TrophyGoblinKing" } }, { "Queen", new string[1] { "TrophySeekerQueen" } }, { "Fader", new string[1] { "TrophyFader" } }, { "Ocean", new string[1] { "TM_TrophyOceanBoss" } }, { "NeckLord", new string[2] { "NeckLordTrophy", "TrophyNeckLord" } }, { "GreydwarfLord", new string[3] { "GreydwarfShamanLordTrophy", "GreydwarfLordTrophy", "TrophyGreydwarfLord" } }, { "DraugrLord", new string[3] { "DraugrEliteLordTrophy", "DraugrLordTrophy", "TrophyDraugrLord" } }, { "FenringLord", new string[2] { "FenringLordTrophy", "TrophyFenringLord" } }, { "LoxLord", new string[2] { "LoxLordTrophy", "TrophyLoxLord" } }, { "SeekerLord", new string[2] { "SeekerLordTrophy", "TrophySeekerLord" } }, { "ValkyrieLord", new string[3] { "ValkyrieLordTrophy", "FallerValkyrieLordTrophy", "TrophyFallenValkyrieLord" } }, { "DeepNorth", new string[2] { "GammeltrollLordTrophy", "TrophyGammeltrollLord" } }, { "Asmodeus", new string[2] { "trophy_asmodeus_TW", "TrophyAsmodeus_TW" } }, { "Svalt", new string[2] { "trophy_svalt_TW", "TrophySvalt_TW" } }, { "Vrykolathas", new string[2] { "trophy_vrykolathas_TW", "TrophyVrykolathas_TW" } }, { "Sythrak", new string[2] { "TrophySythrak_TW", "trophy_sythrak_TW" } } }; private static readonly Dictionary<string, string> KeyToGlobalKey = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "Eikthyr", "defeated_eikthyr" }, { "TheElder", "defeated_gdking" }, { "Bonemass", "defeated_bonemass" }, { "Moder", "defeated_dragon" }, { "Yagluth", "defeated_goblinking" }, { "Queen", "defeated_queen" }, { "Fader", "defeated_fader" }, { "Ocean", "defeated_oceanboss" }, { "NeckLord", "defeated_neck_lord" }, { "GreydwarfLord", "defeated_greydwarf_lord" }, { "DraugrLord", "defeated_draugr_lord" }, { "FenringLord", "defeated_fenring_lord" }, { "LoxLord", "defeated_lox_lord" }, { "SeekerLord", "defeated_seeker_lord" }, { "ValkyrieLord", "defeated_faller_valkyrie_lord" }, { "DeepNorth", "defeated_gammeltroll_lord" }, { "Asmodeus", "defeated_asmodeus" }, { "Svalt", "defeated_svalt" }, { "Vrykolathas", "defeated_vrykolathas" }, { "Sythrak", "defeated_sythrak" } }; private static readonly Dictionary<string, string> KeyToName = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "Eikthyr", ModLanguage.Text("Eikthyr (Ágilidad del Ciervo)") }, { "TheElder", ModLanguage.Text("El Sabio (Arraigo Forestal)") }, { "Bonemass", ModLanguage.Text("Masaósea (Carapacho de Peste)") }, { "Moder", ModLanguage.Text("Moder (Viento Helado & Vuelo de Proyectil)") }, { "Yagluth", ModLanguage.Text("Yagluth (Furia de los Caídos)") }, { "Queen", ModLanguage.Text("La Reina (Clarividencia de la Colmena)") }, { "Fader", ModLanguage.Text("Fader (Dominio Calcinado)") }, { "Ocean", ModLanguage.Text("Jörmungandr (Dominio Abisal de las Mareas)") }, { "NeckLord", ModLanguage.Text("Señor de los Cuellos (Vigor Anfibio & Vitalidad)") }, { "GreydwarfLord", ModLanguage.Text("Chamán Ancestral (Resonancia Silvestre & Regeneración)") }, { "DraugrLord", ModLanguage.Text("Caudillo Draugr (Tenacidad Cadavérica & Drenaje)") }, { "FenringLord", ModLanguage.Text("Señor Fenring (Acechador de las Cumbres & Salto Lupino)") }, { "LoxLord", ModLanguage.Text("Coloso Lox (Piel Pétrea & Firmeza Inquebrantable)") }, { "SeekerLord", ModLanguage.Text("Soberano Buscador (Caparazón Reactivo & Evasión)") }, { "ValkyrieLord", ModLanguage.Text("Valquiria Caída (Gracia Alada & Ascensión Ígnea)") }, { "DeepNorth", ModLanguage.Text("Gammeltroll Lord (Bastión Polar del Norte Profundo)") }, { "Asmodeus", ModLanguage.Text("Asmodeus (Ponzoña Abisal & Mordedura Tóxica)") }, { "Svalt", ModLanguage.Text("Svålt (Furia Berserker & Vigor Voraz)") }, { "Vrykolathas", ModLanguage.Text("Vrykolathas (Manto Vampírico & Cosecha Nocturna)") }, { "Sythrak", ModLanguage.Text("Sythrak (Terror del Trueno & Chispa Celestial)") } }; private static readonly Dictionary<string, string> KeyToDataKey = BuildDataKeys(); private static readonly Dictionary<string, string> KeyToAltGlobalKey = BuildAltGlobalKeys(); private static readonly Dictionary<string, int> s_activeRankCache = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase); private static int s_cachedPlayerId; private static float s_nextRankCacheRefresh; private static PlayerCombatProfile s_cachedProfile; private static float s_nextProfileRefresh; private static int s_profilePlayerId; private static float s_nextSpeedCacheRefresh; private static float s_cachedSpeedMult = 1f; private static Dictionary<string, string> BuildDataKeys() { Dictionary<string, string> dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); string[] allBossKeys = AllBossKeys; foreach (string text in allBossKeys) { dictionary[text] = "TM_BossRank_" + text; } return dictionary; } private static Dictionary<string, string> BuildAltGlobalKeys() { Dictionary<string, string> dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); foreach (KeyValuePair<string, string> item in KeyToGlobalKey) { dictionary[item.Key] = item.Value.Replace("_", ""); } return dictionary; } public static void InvalidateCache() { s_nextRankCacheRefresh = 0f; s_nextSpeedCacheRefresh = 0f; s_nextProfileRefresh = 0f; } public static PlayerCombatProfile GetPlayerProfile(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return default(PlayerCombatProfile); } int instanceID = ((Object)player).GetInstanceID(); float time = Time.time; if (instanceID == s_profilePlayerId && time < s_nextProfileRefresh) { return s_cachedProfile; } s_profilePlayerId = instanceID; s_nextProfileRefresh = time + 0.5f; int activeRank = GetActiveRank(player, "TheElder"); int activeRank2 = GetActiveRank(player, "Bonemass"); int activeRank3 = GetActiveRank(player, "Moder"); int activeRank4 = GetActiveRank(player, "Yagluth"); int activeRank5 = GetActiveRank(player, "Queen"); int activeRank6 = GetActiveRank(player, "Fader"); int activeRank7 = GetActiveRank(player, "Ocean"); int activeRank8 = GetActiveRank(player, "DraugrLord"); int activeRank9 = GetActiveRank(player, "FenringLord"); int activeRank10 = GetActiveRank(player, "LoxLord"); int activeRank11 = GetActiveRank(player, "SeekerLord"); int activeRank12 = GetActiveRank(player, "ValkyrieLord"); int activeRank13 = GetActiveRank(player, "DeepNorth"); int activeRank14 = GetActiveRank(player, "Asmodeus"); int activeRank15 = GetActiveRank(player, "Svalt"); int activeRank16 = GetActiveRank(player, "Sythrak"); s_cachedProfile = new PlayerCombatProfile { FireRatio = GetYagluthBonusFireRatioByRank(activeRank4), FaderPhysicalMultiplier = GetFaderPhysicalDamageMultiplierByRank(activeRank6), ElderChopMultiplier = GetElderChopMultiplierByRank(activeRank), QueenMiningMultiplier = GetQueenMiningMultiplierByRank(activeRank5), OceanCombatMultiplier = GetOceanCombatBonusByRank(activeRank7), ModerProjectileMultiplier = GetModerProjectileMultiplierByRank(activeRank3), LoxBluntMultiplier = GetLoxLordBluntDamageMultiplierByRank(activeRank10), ValkAerialMultiplier = GetValkyrieLordAerialDamageMultiplierByRank(activeRank12), FenringBackstabBonus = GetFenringLordBackstabBonusByRank(activeRank9), AsmodeusPoisonBonus = GetAsmodeusBonusPoisonByRank(activeRank14), SvaltBerserkerMaxBonus = GetSvaltBerserkerMaxBonusByRank(activeRank15), SythrakLightningBonus = GetSythrakBonusLightningByRank(activeRank16), DraugrLifestealRatio = GetDraugrLordLifestealRatioByRank(activeRank8), BonemassPhysicalMitigation = GetBonemassPhysicalMitigationByRank(activeRank2), BonemassPoisonResistance = GetBonemassPoisonResistanceByRank(activeRank2), IsAsmodeusPoisonImmune = (activeRank14 >= 1), YagluthElementalMitigation = GetYagluthElementalMitigationByRank(activeRank4), ValkFireMitigation = GetValkyrieLordFireMitigationByRank(activeRank12), SythrakLightningMitigation = GetSythrakLightningMitigationByRank(activeRank16), DeepNorthFrostMitigation = GetDeepNorthFrostMitigationByRank(activeRank13), DeepNorthArmorBonus = activeRank13 switch { 3 => 35f, 2 => 25f, 1 => 15f, _ => 0f, }, LoxArmorBonus = GetLoxLordArmorBonusByRank(activeRank10), DraugrArmorBonus = GetDraugrLordArmorBonusByRank(activeRank8), FenringFallDiscount = GetFenringLordFallDamageDiscountByRank(activeRank9), SeekerThornsRatio = GetSeekerLordThornsRatioByRank(activeRank11) }; return s_cachedProfile; } public static string ResolveBossKey(string powerOrBoss) { if (string.IsNullOrEmpty(powerOrBoss)) { return ""; } if (PowerToKey.TryGetValue(powerOrBoss, out var value)) { return value; } foreach (KeyValuePair<string, string> item in PowerToKey) { if (powerOrBoss.IndexOf(item.Key, StringComparison.OrdinalIgnoreCase) >= 0) { return item.Value; } } return ""; } public static string GetActiveBossKey(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return ""; } return ResolveBossKey(player.GetGuardianPowerName()); } public static int GetBossRank(Player player, string bossKey) { if (!Object.op_Implicit((Object)(object)player) || string.IsNullOrEmpty(bossKey)) { return 0; } if (!KeyToDataKey.TryGetValue(bossKey, out var value)) { value = "TM_BossRank_" + bossKey; } if (player.m_customData != null && player.m_customData.TryGetValue(value, out var value2) && !string.IsNullOrEmpty(value2)) { char c = value2[0]; if (c >= '1' && c <= '3') { return c - 48; } if (int.TryParse(value2, out var result)) { return Mathf.Clamp(result, 1, 3); } } return 0; } public static void SetBossRank(Player player, string bossKey, int rank) { if (Object.op_Implicit((Object)(object)player) && !string.IsNullOrEmpty(bossKey)) { if (!KeyToDataKey.TryGetValue(bossKey, out var value)) { value = "TM_BossRank_" + bossKey; } if (player.m_customData == null) { player.m_customData = new Dictionary<string, string>(); } int num = Mathf.Clamp(rank, 1, 3); player.m_customData[value] = num switch { 2 => "2", 1 => "1", _ => "3", }; InvalidateCache(); } } public static bool IsBossDefeatedInWorld(string bossKey) { if ((Object)(object)ZoneSystem.instance == (Object)null || string.IsNullOrEmpty(bossKey)) { return BiomeProgression.Defeated(false, bossKey); } if (KeyToGlobalKey.TryGetValue(bossKey, out var value)) { if (ZoneSystem.instance.GetGlobalKey(value)) { return BiomeProgression.Defeated(true, bossKey); } if (KeyToAltGlobalKey.TryGetValue(bossKey, out var value2) && ZoneSystem.instance.GetGlobalKey(value2)) { return BiomeProgression.Defeated(true, bossKey); } } return BiomeProgression.Defeated(false, bossKey); } public static int GetActiveRank(Player player, string targetKey) { if (!Object.op_Implicit((Object)(object)player) || string.IsNullOrEmpty(targetKey)) { return 0; } int instanceID = ((Object)player).GetInstanceID(); float time = Time.time; if (instanceID != s_cachedPlayerId || time >= s_nextRankCacheRefresh) { s_cachedPlayerId = instanceID; s_nextRankCacheRefresh = time + 1f; string text = RevisionRuntime.VanillaActiveKey(GetActiveBossKey(player)); for (int i = 0; i < AllBossKeys.Length; i++) { string text2 = AllBossKeys[i]; int num = GetBossRank(player, text2); if (num <= 0) { if (!string.IsNullOrEmpty(text) && string.Equals(text, text2, StringComparison.OrdinalIgnoreCase)) { num = 1; } else if (RevisionRuntime.AutoRankFromWorld(text2)) { num = 1; } } s_activeRankCache[text2] = num; } } if (!s_activeRankCache.TryGetValue(targetKey, out var value)) { return 0; } return value; } public static string GetPrimaryTrophyPrefab(string bossKey) { if (KeyToTrophies.TryGetValue(bossKey, out var value) && value != null && value.Length != 0) { return value[0]; } return ""; } public static string[] GetTrophyPrefabs(string bossKey) { if (KeyToTrophies.TryGetValue(bossKey, out var value)) { return value; } return new string[0]; } public static string GetBossName(string bossKey) { if (KeyToName.TryGetValue(bossKey, out var value)) { return value; } return bossKey; } public static int GetTrophiesNeededForNextRank(int currentRank) { if (currentRank <= 1) { return 1; } if (currentRank == 2) { return 2; } return 0; } public static int CountBossTrophies(Player player, string bossKey) { return TrophyTransactions.Count(player, GetTrophyPrefabs(bossKey)); } public static bool ConsumeBossTrophies(Player player, string bossKey, int amount) { return TrophyTransactions.Consume(player, GetTrophyPrefabs(bossKey), amount); } public static bool TryOfferTrophyForUpgrade(Player player, string bossKey) { //IL_011e: Unknown result type (might be
TameMate.Lineages.dll
Decompiled 3 days 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.Globalization; using System.IO; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Splatform; using TMPro; using TameMate.Lineages; using TameMate.OceanHorn; using TameMate.Survival; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.8.0.0")] namespace TameMate.Lineages { internal static class AscensionModalInput { private static bool s_captured; private static int s_closedFrame = -10; internal static bool ConfirmSelected { get; private set; } private static bool BlocksInput { get { if (!EvolutionAscensionEngine.IsModalOpen) { return Time.frameCount <= s_closedFrame; } return true; } } internal static void Install(Harmony harmony) { Patch(harmony, typeof(PlayerController), "TakeInput", new Type[1] { typeof(bool) }, "TakeInputPostfix", prefix: false); Patch(harmony, typeof(Player), "TakeInput", Type.EmptyTypes, "PlayerInputPostfix", prefix: false); Patch(harmony, typeof(PlayerController), "InInventoryEtc", Type.EmptyTypes, "InventoryPostfix", prefix: false); Patch(harmony, typeof(GameCamera), "UpdateMouseCapture", Type.EmptyTypes, "MouseCapturePostfix", prefix: false); Patch(harmony, typeof(GameCamera), "UpdateCamera", new Type[1] { typeof(float) }, "CameraPrefix", prefix: true); Patch(harmony, typeof(Menu), "Update", Type.EmptyTypes, "MenuPrefix", prefix: true); } private static void Patch(Harmony harmony, Type type, string name, Type[] parameters, string handler, bool prefix) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(type, name, parameters, (Type[])null); if (methodInfo == null) { throw new MissingMethodException(type.FullName, name); } HarmonyMethod val = new HarmonyMethod(AccessTools.Method(typeof(AscensionModalInput), handler, (Type[])null, (Type[])null)); val.priority = 0; harmony.Patch((MethodBase)methodInfo, prefix ? val : null, prefix ? null : val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } internal static void Acquire(Player player) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) s_captured = true; ConfirmSelected = false; player.m_autoRun = false; player.SetControls(Vector3.zero, false, false, false, false, false, false, false, false, false, false, false); ShowCursor(); } internal static void ShowCursor() { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; ZCursor.LockState = (CursorLockMode)0; ZCursor.Show(); } internal static void Release() { if (s_captured) { s_captured = false; s_closedFrame = Time.frameCount; PlayerController.SetTakeInputDelay(0.2f); if ((Object)(object)GameCamera.instance != (Object)null) { GameCamera.instance.UpdateMouseCapture(); } } } internal static bool HandleKey(KeyCode key) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Invalid comparison between Unknown and I4 //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Invalid comparison between Unknown and I4 if (!EvolutionAscensionEngine.IsModalOpen) { return false; } if ((int)key == 9) { ConfirmSelected = !ConfirmSelected; } else if ((int)key == 276) { ConfirmSelected = true; } else if ((int)key == 275) { ConfirmSelected = false; } else if ((int)key == 27) { EvolutionAscensionEngine.CloseModal(); } else { if ((int)key != 13 && (int)key != 271) { return false; } if (ConfirmSelected) { EvolutionAscensionEngine.ConfirmAscension(); } else { EvolutionAscensionEngine.CloseModal(); } } return true; } private static void TakeInputPostfix(ref bool __result) { if (BlocksInput) { __result = false; } } private static void PlayerInputPostfix(Player __instance, ref bool __result) { if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer && BlocksInput) { __result = false; } } private static void InventoryPostfix(ref bool __result) { if (BlocksInput) { __result = true; } } private static void MouseCapturePostfix() { if (EvolutionAscensionEngine.IsModalOpen) { ShowCursor(); } } private static bool CameraPrefix() { return !BlocksInput; } private static bool MenuPrefix() { if (!EvolutionAscensionEngine.IsModalOpen) { return Time.frameCount > s_closedFrame; } return false; } } public static class AutonomousDifficultyBalance { private static bool s_isInstalled; private static ManualLogSource s_logger; private static Harmony s_harmonyInstance; private static volatile bool s_isScalingActive; public static bool IsScalingActive => s_isScalingActive; public static void Install(Harmony harmony, ManualLogSource logger) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown if (s_isInstalled) { return; } s_logger = logger; s_harmonyInstance = harmony; try { MethodInfo methodInfo = AccessTools.Method(typeof(Character), "GetMaxHealth", (Type[])null, (Type[])null); if (methodInfo == null) { throw new MissingMethodException("Character", "GetMaxHealth"); } MethodInfo methodInfo2 = AccessTools.Method(typeof(AutonomousDifficultyBalance), "GetMaxHealthPostfix", (Type[])null, (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo3 = AccessTools.Method(typeof(ZNet), "Awake", (Type[])null, (Type[])null); if (methodInfo3 != null) { MethodInfo methodInfo4 = AccessTools.Method(typeof(AutonomousDifficultyBalance), "OnWorldEnterPostfix", (Type[])null, (Type[])null); harmony.Patch((MethodBase)methodInfo3, (HarmonyMethod)null, new HarmonyMethod(methodInfo4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo5 = AccessTools.Method(typeof(ZNet), "OnDestroy", (Type[])null, (Type[])null); if (methodInfo5 != null) { MethodInfo methodInfo6 = AccessTools.Method(typeof(AutonomousDifficultyBalance), "OnWorldExitPrefix", (Type[])null, (Type[])null); harmony.Patch((MethodBase)methodInfo5, new HarmonyMethod(methodInfo6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } s_isInstalled = true; InvalidateCache(); if (s_logger != null) { s_logger.LogInfo((object)"[AutonomousDifficultyBalance] Autonomous +25% wild health balance installed with zero-overhead cached execution."); } } catch (Exception ex) { if (harmony != null) { try { harmony.UnpatchSelf(); } catch { } } s_isInstalled = false; s_isScalingActive = false; if (s_logger != null) { s_logger.LogError((object)("[AutonomousDifficultyBalance] Installation failed (rolled back atomically): " + ex.Message)); } throw; } } public static void Uninstall() { if (s_harmonyInstance != null) { try { s_harmonyInstance.UnpatchSelf(); } catch { } } s_isInstalled = false; s_isScalingActive = false; } public static void OnWorldEnterPostfix() { InvalidateCache(); } public static void OnWorldExitPrefix() { ResetCache(); } public static void InvalidateCache() { bool flag = s_isScalingActive; s_isScalingActive = ComputeScalingActive(); if (s_logger != null && flag != s_isScalingActive) { s_logger.LogInfo((object)$"[AutonomousDifficultyBalance] Cached scaling state updated: {s_isScalingActive} (Preset: {DifficultyCoordinator.GetActivePreset()}, ExternalScaling: {IsExternalHealthScalingActive()})"); } } public static void ResetCache() { s_isScalingActive = false; if (s_logger != null) { s_logger.LogInfo((object)"[AutonomousDifficultyBalance] Cached scaling state reset (world exit / clean state)."); } } private static bool ComputeScalingActive() { try { if (DifficultyCoordinator.GetActivePreset() != DifficultyPreset.Dificil) { return false; } if (IsExternalHealthScalingActive()) { return false; } return true; } catch (Exception ex) { if (s_logger != null) { s_logger.LogWarning((object)("[AutonomousDifficultyBalance] Error computing scaling state: " + ex.Message)); } return false; } } public static bool IsExternalHealthScalingActive() { try { if (Chainloader.PluginInfos != null && Chainloader.PluginInfos.ContainsKey("MidnightsFX.StarLevelSystem")) { return true; } if (AccessTools.TypeByName("StarLevelSystem.LevelSystem") != null || AccessTools.TypeByName("StarLevelSystem.StarLevelSystem") != null) { return true; } } catch { } try { if (StarLevelSystemAdapter.IsConfigFileAvailable) { return true; } } catch { } try { if (Chainloader.PluginInfos != null && Chainloader.PluginInfos.ContainsKey("org.bepinex.plugins.creaturelevelcontrol")) { return true; } if (AccessTools.TypeByName("CreatureLevelControl.CreatureLevelControl") != null) { return true; } } catch { } return false; } public static void GetMaxHealthPostfix(Character __instance, ref float __result) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (s_isScalingActive && !((Object)(object)__instance == (Object)null) && !__instance.IsPlayer() && !__instance.IsBoss() && !__instance.IsTamed() && (int)__instance.m_faction != 0) { __result *= 1.25f; } } } public struct BossAddSnapshot { public bool IsAvailable; public float BonemassHealthMultiplier; public float BonemassMoveSpeedMultiplier; public float BonemassAttackSpeedMultiplier; public bool SummonMechanicEnabled; public string ConfigPath; public static BossAddSnapshot CreateDefault() { return new BossAddSnapshot { IsAvailable = false, BonemassHealthMultiplier = 1f, BonemassMoveSpeedMultiplier = 1f, BonemassAttackSpeedMultiplier = 1f, SummonMechanicEnabled = true, ConfigPath = string.Empty }; } } public static class BossAddAdapter { public const string BossAddPluginGuid = "bossadd"; private const string ConfigFileName = "bossadd.cfg"; public const string AuthorizedPrefabName = "vfx_corpse_destruction_large"; public const int AuthorizedPrefabHash = 1848449852; public const int RequiredConsecutiveSamples = 3; private static bool? s_isPluginLoadedCached = null; private static string s_customConfigPath = null; private static ManualLogSource s_logger = null; private static bool s_isInstalled = false; private static readonly Dictionary<ZDOID, int> s_stagnantObservations = new Dictionary<ZDOID, int>(); private static readonly Dictionary<ZDOID, float> s_firstObservedTime = new Dictionary<ZDOID, float>(); public static bool IsInstalled => s_isInstalled; public static bool IsAvailable { get { if (!IsPluginLoaded) { return IsConfigFileAvailable; } return true; } } public static bool IsPluginLoaded { get { if (s_isPluginLoadedCached.HasValue) { return s_isPluginLoadedCached.Value; } try { if (Chainloader.PluginInfos != null && Chainloader.PluginInfos.TryGetValue("bossadd", out var value)) { if (value != null && value.Metadata != null && value.Metadata.Version != null) { if (value.Metadata.Version.Major == 1 && value.Metadata.Version.Minor == 2 && value.Metadata.Version.Build == 4) { s_isPluginLoadedCached = true; return true; } if (s_logger != null) { s_logger.LogWarning((object)$"[TameMate BossAddAdapter] BossAdd versión {value.Metadata.Version} detectada. Compatibilidad validada exclusivamente para versión 1.2.4; adaptador inactivo."); } s_isPluginLoadedCached = false; return false; } s_isPluginLoadedCached = false; return false; } } catch { } try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { string name = assemblies[i].GetName().Name; if (string.Equals(name, "bossadd", StringComparison.OrdinalIgnoreCase) || string.Equals(name, "bossadd.merged", StringComparison.OrdinalIgnoreCase)) { Version version = assemblies[i].GetName().Version; if (version == null || (version.Major == 1 && version.Minor == 2)) { s_isPluginLoadedCached = true; return true; } } } } catch { } s_isPluginLoadedCached = false; return false; } } public static bool IsConfigFileAvailable { get { string text = ResolveConfigFilePath(); if (!string.IsNullOrEmpty(text)) { return File.Exists(text); } return false; } } public static void SetCustomConfigPathForTesting(string path) { s_customConfigPath = path; } public static void SetPluginLoadedForTesting(bool? loaded) { s_isPluginLoadedCached = loaded; } public static string ResolveConfigFilePath() { if (!string.IsNullOrEmpty(s_customConfigPath)) { return s_customConfigPath; } try { string configPath = Paths.ConfigPath; if (!string.IsNullOrEmpty(configPath)) { string text = Path.Combine(configPath, "bossadd.cfg"); if (File.Exists(text)) { return text; } } } catch { } string text2 = "C:\\Users\\Mitsu\\AppData\\Roaming\\Thunderstore Mod Manager\\DataFolder\\Valheim\\profiles\\Valheim Supreme\\BepInEx\\config"; if (Directory.Exists(text2)) { string text3 = Path.Combine(text2, "bossadd.cfg"); if (File.Exists(text3)) { return text3; } } return string.Empty; } public static BossAddSnapshot CaptureCurrentState() { BossAddSnapshot result = BossAddSnapshot.CreateDefault(); string text = (result.ConfigPath = ResolveConfigFilePath()); if (string.IsNullOrEmpty(text) || !File.Exists(text)) { result.IsAvailable = IsPluginLoaded; return result; } result.IsAvailable = true; try { string[] array = File.ReadAllLines(text); string a = string.Empty; for (int i = 0; i < array.Length; i++) { string text2 = array[i].Trim(); if (string.IsNullOrEmpty(text2) || text2.StartsWith("#")) { continue; } if (text2.StartsWith("[") && text2.EndsWith("]")) { a = text2.Substring(1, text2.Length - 2).Trim(); continue; } int num = text2.IndexOf('='); if (num <= 0) { continue; } string a2 = text2.Substring(0, num).Trim(); string text3 = text2.Substring(num + 1).Trim(); if (!string.Equals(a, "Bonemass", StringComparison.OrdinalIgnoreCase)) { continue; } if (string.Equals(a2, "(Boss Stat) HealthMultiplier", StringComparison.OrdinalIgnoreCase)) { if (float.TryParse(text3, NumberStyles.Float, CultureInfo.InvariantCulture, out var result2)) { result.BonemassHealthMultiplier = result2; } } else if (string.Equals(a2, "(Boss Stat) MoveSpeedMultiplier", StringComparison.OrdinalIgnoreCase)) { if (float.TryParse(text3, NumberStyles.Float, CultureInfo.InvariantCulture, out var result3)) { result.BonemassMoveSpeedMultiplier = result3; } } else if (string.Equals(a2, "(Boss Stat) AttackSpeedMultiplier", StringComparison.OrdinalIgnoreCase)) { if (float.TryParse(text3, NumberStyles.Float, CultureInfo.InvariantCulture, out var result4)) { result.BonemassAttackSpeedMultiplier = result4; } } else if (string.Equals(a2, "(Summon) Enabled", StringComparison.OrdinalIgnoreCase)) { result.SummonMechanicEnabled = string.Equals(text3, "true", StringComparison.OrdinalIgnoreCase); } } } catch { } return result; } public static void ResetCache() { s_isPluginLoadedCached = null; } public static void Install(Harmony harmony, ManualLogSource logger) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown if (s_isInstalled || harmony == null) { return; } s_logger = logger; try { MethodInfo method = typeof(ZNetScene).GetMethod("RemoveObjects", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { MethodInfo method2 = typeof(BossAddAdapter).GetMethod("RemoveObjectsPrefix", BindingFlags.Static | BindingFlags.NonPublic); harmony.Patch((MethodBase)method, new HarmonyMethod(method2, 800, (string[])null, (string[])null, (bool?)null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo method3 = typeof(Player).GetMethod("UpdateTeleport", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method3 != null) { MethodInfo method4 = typeof(BossAddAdapter).GetMethod("UpdateTeleportPostfix", BindingFlags.Static | BindingFlags.NonPublic); harmony.Patch((MethodBase)method3, (HarmonyMethod)null, new HarmonyMethod(method4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo method5 = typeof(Game).GetMethod("UpdateRespawn", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method5 != null) { MethodInfo method6 = typeof(BossAddAdapter).GetMethod("UpdateRespawnPostfix", BindingFlags.Static | BindingFlags.NonPublic); harmony.Patch((MethodBase)method5, (HarmonyMethod)null, new HarmonyMethod(method6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } s_isInstalled = true; if (s_logger != null) { s_logger.LogInfo((object)"BossAddAdapter: salvaguardas de limpieza de escena y recuperación de VFX instaladas con éxito."); } } catch (Exception ex) { if (s_logger != null) { s_logger.LogError((object)("Fallo al instalar BossAddAdapter: " + ex)); } } } public static void Uninstall() { s_isInstalled = false; s_logger = null; s_stagnantObservations.Clear(); s_firstObservedTime.Clear(); } private static void RemoveObjectsPrefix(ZNetScene __instance) { if (!IsPluginLoaded || (Object)(object)__instance == (Object)null) { return; } FieldInfo field = typeof(ZNetScene).GetField("m_instances", BindingFlags.Instance | BindingFlags.NonPublic); if (field == null || !(field.GetValue(__instance) is Dictionary<ZDO, ZNetView> { Count: not 0 } dictionary)) { return; } List<ZDO> list = null; foreach (KeyValuePair<ZDO, ZNetView> item in dictionary) { if (!Object.op_Implicit((Object)(object)item.Value) || item.Value.GetZDO() == null) { if (list == null) { list = new List<ZDO>(); } list.Add(item.Key); } } if (list == null || list.Count <= 0) { return; } bool flag = (Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsServer(); int num = 0; for (int i = 0; i < list.Count; i++) { ZDO val = list[i]; dictionary.Remove(val); int prefab = val.GetPrefab(); if (prefab == 1848449852) { if (flag && ZDOMan.instance != null) { val.SetOwner(ZDOMan.GetSessionID()); ZDOMan.instance.DestroyZDO(val); num++; } else { val.Created = false; } } else { val.Created = false; } } if (num > 0 && s_logger != null) { s_logger.LogInfo((object)$"[TameMate BossAddAdapter] Prevenido fallo en RemoveObjects: {num} ZDO(s) de efectos efímeros purgados limpiamente."); } } private static void UpdateTeleportPostfix(Player __instance, float dt) { //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_00a9: Unknown result type (might be due to invalid IL or missing references) if (!IsPluginLoaded || (Object)(object)__instance == (Object)null) { return; } FieldInfo field = typeof(Player).GetField("m_teleporting", BindingFlags.Instance | BindingFlags.NonPublic); FieldInfo field2 = typeof(Player).GetField("m_teleportTimer", BindingFlags.Instance | BindingFlags.NonPublic); FieldInfo field3 = typeof(Player).GetField("m_teleportTargetPos", BindingFlags.Instance | BindingFlags.NonPublic); if (!(field == null) && !(field2 == null) && !(field3 == null) && (bool)field.GetValue(__instance)) { float num = (float)field2.GetValue(__instance); if (!(num < 3f)) { Vector3 targetPos = (Vector3)field3.GetValue(__instance); RecoverOrphanedVFXInTargetArea(targetPos); } } } private static void UpdateRespawnPostfix(Game __instance, float dt) { //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_00f8: 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_00c7: Unknown result type (might be due to invalid IL or missing references) if (!IsPluginLoaded || (Object)(object)__instance == (Object)null) { return; } FieldInfo field = typeof(Game).GetField("m_requestRespawn", BindingFlags.Instance | BindingFlags.NonPublic); FieldInfo field2 = typeof(Game).GetField("m_respawnWait", BindingFlags.Instance | BindingFlags.NonPublic); FieldInfo field3 = typeof(Game).GetField("m_playerProfile", BindingFlags.Instance | BindingFlags.NonPublic); if (field == null || field2 == null || !(bool)field.GetValue(__instance)) { return; } float num = (float)field2.GetValue(__instance); if (!(num < 3f)) { Vector3 targetPos = Vector3.zero; PlayerProfile val = (PlayerProfile)((field3 != null) ? /*isinst with value type is only supported in some contexts*/: null); if (val != null && val.HaveCustomSpawnPoint()) { targetPos = val.GetCustomSpawnPoint(); } else if ((Object)(object)ZoneSystem.instance != (Object)null && !string.IsNullOrEmpty(__instance.m_StartLocation)) { ZoneSystem.instance.GetLocationIcon(__instance.m_StartLocation, ref targetPos); } RecoverOrphanedVFXInTargetArea(targetPos); } } [MethodImpl(MethodImplOptions.NoInlining)] public static int RecoverOrphanedVFXInTargetArea(Vector3 targetPos) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (!IsPluginLoaded) { return 0; } return RecoverOrphanedVFXInTargetAreaInternal(targetPos); } [MethodImpl(MethodImplOptions.NoInlining)] private static int RecoverOrphanedVFXInTargetAreaInternal(Vector3 targetPos) { //IL_001c: 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_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_007d: 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_00be: 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_00f6: 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_0119: 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_012e: 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_02b9: 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) //IL_0302: 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_025c: Unknown result type (might be due to invalid IL or missing references) if (ZoneSystem.instance == null || ZNetScene.instance == null || ZDOMan.instance == null) { return 0; } if (ZNetScene.instance.IsAreaReady(targetPos)) { if (s_stagnantObservations.Count > 0) { s_stagnantObservations.Clear(); s_firstObservedTime.Clear(); } return 0; } if (ZNet.instance == null || !ZNet.instance.IsServer()) { return 0; } Vector2s zone = ZoneSystem.GetZone(targetPos); List<ZDO> list = new List<ZDO>(); SimulationDistance val = default(SimulationDistance); ((SimulationDistance)(ref val))..ctor(1, 0, false); ZDOMan.instance.FindSectorObjects(zone, val, list, (List<ZDO>)null); int num = 0; HashSet<ZDOID> hashSet = new HashSet<ZDOID>(); for (int i = 0; i < list.Count; i++) { ZDO val2 = list[i]; if (val2 == null || val2.GetPrefab() != 1848449852) { continue; } hashSet.Add(val2.m_uid); if ((Object)(object)ZNetScene.instance.FindInstance(val2) != (Object)null) { s_stagnantObservations.Remove(val2.m_uid); s_firstObservedTime.Remove(val2.m_uid); } else { if (!val2.Created) { continue; } if (!s_stagnantObservations.TryGetValue(val2.m_uid, out var value)) { s_stagnantObservations[val2.m_uid] = 1; s_firstObservedTime[val2.m_uid] = Time.realtimeSinceStartup; continue; } value++; s_stagnantObservations[val2.m_uid] = value; if (value >= 3) { GameObject prefab = ZNetScene.instance.GetPrefab(1848449852); if ((Object)(object)prefab != (Object)null && string.Equals(((Object)prefab).name, "vfx_corpse_destruction_large", StringComparison.Ordinal) && (Object)(object)prefab.GetComponent<Piece>() == (Object)null && (Object)(object)prefab.GetComponent<Character>() == (Object)null && (Object)(object)prefab.GetComponent<Container>() == (Object)null && (Object)(object)prefab.GetComponent<ItemDrop>() == (Object)null && (Object)(object)prefab.GetComponent<TombStone>() == (Object)null && (Object)(object)prefab.GetComponent<TeleportWorld>() == (Object)null && (Object)(object)prefab.GetComponent<Bed>() == (Object)null && (Object)(object)prefab.GetComponent<Door>() == (Object)null) { val2.SetOwner(ZDOMan.GetSessionID()); ZDOMan.instance.DestroyZDO(val2); s_stagnantObservations.Remove(val2.m_uid); s_firstObservedTime.Remove(val2.m_uid); num++; } } } } List<ZDOID> list2 = null; foreach (KeyValuePair<ZDOID, int> s_stagnantObservation in s_stagnantObservations) { if (!hashSet.Contains(s_stagnantObservation.Key)) { if (list2 == null) { list2 = new List<ZDOID>(); } list2.Add(s_stagnantObservation.Key); } } if (list2 != null) { for (int j = 0; j < list2.Count; j++) { s_stagnantObservations.Remove(list2[j]); s_firstObservedTime.Remove(list2[j]); } } if (num > 0 && s_logger != null) { s_logger.LogWarning((object)$"[TameMate BossAddAdapter] Recuperado sector ({zone.x}, {zone.y}): purgados {num} ZDO(s) huérfanos estancados de vfx_corpse_destruction_large. Transición de carga desbloqueada."); } return num; } } public static class CataclysmicCombatPipeline { private static bool s_installed = false; private static readonly HashSet<HitData> s_processedOutgoingHits = new HashSet<HitData>(); public static void Install(Harmony harmony, Assembly coreAssembly) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown if (s_installed) { return; } s_installed = true; try { MethodInfo methodInfo = AccessTools.Method(typeof(Character), "Damage", new Type[1] { typeof(HitData) }, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(CataclysmicCombatPipeline), "CombatDamagePrefix", (Type[])null, (Type[])null); if (methodInfo != null && methodInfo2 != null) { harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2, 600, (string[])null, (string[])null, (bool?)null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } catch (Exception ex) { Debug.LogWarning((object)("[TameMate Lineages] CataclysmicCombatPipeline.Install warning: " + ex.Message)); } } [HarmonyPriority(600)] public static void CombatDamagePrefix(Character __instance, HitData hit) { if (!((Object)(object)__instance == (Object)null) && hit != null) { Character attacker = hit.GetAttacker(); if ((Object)(object)attacker != (Object)null && attacker.IsTamed() && !attacker.IsPlayer()) { CataclysmicHudFormatter.EnsureLiveStateSynchronized(attacker); ApplyOutgoingCataclysmicAttack(attacker, hit); } if (__instance.IsTamed() && !__instance.IsPlayer()) { CataclysmicHudFormatter.EnsureLiveStateSynchronized(__instance); ApplyIncomingCataclysmicEffects(__instance, hit); } } } public static void ApplyOutgoingCataclysmicAttack(Character attacker, HitData hit) { if ((Object)(object)attacker == (Object)null || hit == null || !s_processedOutgoingHits.Add(hit)) { return; } if (s_processedOutgoingHits.Count > 256) { s_processedOutgoingHits.Clear(); } ZNetView component = ((Component)attacker).GetComponent<ZNetView>(); ZDO val = (((Object)(object)component != (Object)null && !object.ReferenceEquals(component, null)) ? SafeGetZDO(component) : null); if (val == null) { return; } CataclysmicClassification cataclysmicClassification = CataclysmicStateReader.Classify(val); if (cataclysmicClassification == CataclysmicClassification.DecoupledCataclysmic) { float num = hit.m_damage.m_blunt + hit.m_damage.m_slash + hit.m_damage.m_pierce; if (!(num <= 0.001f)) { string eventName = val.GetString(CataclysmicStateReader.SavedEventKey, ""); float fraction = (CataclysmicStateReader.IsUndead(val) ? 0.15f : 0.2f); ApplyElementalEventDamage(hit, eventName, num, fraction); } } } public static void ApplyIncomingCataclysmicEffects(Character target, HitData hit) { if ((Object)(object)target == (Object)null || hit == null) { return; } ZNetView component = ((Component)target).GetComponent<ZNetView>(); ZDO val = (((Object)(object)component != (Object)null && !object.ReferenceEquals(component, null)) ? SafeGetZDO(component) : null); if (val != null && CataclysmicStateReader.IsCataclysmic(val)) { string eventName = val.GetString(CataclysmicStateReader.SavedEventKey, ""); ApplyElementalEventResistance(hit, eventName); CataclysmicClassification cataclysmicClassification = CataclysmicStateReader.Classify(val); if (cataclysmicClassification == CataclysmicClassification.DecoupledCataclysmic) { int effectiveBaseTier = CataclysmicStateReader.GetEffectiveBaseTier(val); bool flag = CataclysmicStateReader.IsUndead(val); float baseTierReduction = GetBaseTierReduction(effectiveBaseTier); float num = baseTierReduction + (flag ? 0.08f : 0f); float num2 = Mathf.Clamp01(num + 0.08f); float num3 = (1f - num2) / Mathf.Max(0.001f, 1f - num); hit.ApplyModifier(num3); } } } public static float GetBaseTierReduction(int tier) { return tier switch { 1 => 0.08f, 2 => 0.12f, 3 => 0.16f, 4 => 0.33f, 5 => 0.38f, 6 => 0.44f, 7 => 0.5f, 8 => 0.55f, 9 => 0.28f, 10 => 0.6f, _ => 0.08f, }; } private static ZDO SafeGetZDO(ZNetView view) { try { return view.IsValid() ? view.GetZDO() : null; } catch { return null; } } public static void ApplyElementalEventDamage(HitData hit, string eventName, float physDmg, float fraction = 0.15f) { if (hit != null && !(physDmg <= 0.001f)) { float num = physDmg * fraction; if (string.Equals(eventName, "Blizzard", StringComparison.OrdinalIgnoreCase)) { ref DamageTypes damage = ref hit.m_damage; damage.m_frost += num; } else if (string.Equals(eventName, "Thunderstorm", StringComparison.OrdinalIgnoreCase)) { ref DamageTypes damage2 = ref hit.m_damage; damage2.m_lightning += num; } else if (string.Equals(eventName, "ToxicFog", StringComparison.OrdinalIgnoreCase)) { ref DamageTypes damage3 = ref hit.m_damage; damage3.m_poison += num; } else if (string.Equals(eventName, "MagicalAurora", StringComparison.OrdinalIgnoreCase)) { ref DamageTypes damage4 = ref hit.m_damage; damage4.m_spirit += physDmg * 0.1f; } else { ref DamageTypes damage5 = ref hit.m_damage; damage5.m_fire += num; } } } public static void ApplyElementalEventResistance(HitData hit, string eventName) { if (hit != null) { if (string.Equals(eventName, "Blizzard", StringComparison.OrdinalIgnoreCase)) { ref DamageTypes damage = ref hit.m_damage; damage.m_frost *= 0.5f; } else if (string.Equals(eventName, "Thunderstorm", StringComparison.OrdinalIgnoreCase)) { ref DamageTypes damage2 = ref hit.m_damage; damage2.m_lightning *= 0.5f; } else if (string.Equals(eventName, "ToxicFog", StringComparison.OrdinalIgnoreCase)) { ref DamageTypes damage3 = ref hit.m_damage; damage3.m_poison *= 0.5f; } else if (string.Equals(eventName, "MagicalAurora", StringComparison.OrdinalIgnoreCase)) { ref DamageTypes damage4 = ref hit.m_damage; damage4.m_spirit *= 0.5f; } else { ref DamageTypes damage5 = ref hit.m_damage; damage5.m_fire *= 0.5f; } } } public static float ComputeEffectiveDamageReduction(int baseTier, bool isCataclysmic, bool isUndead, bool isTamed) { float num = 0.08f; num = baseTier switch { 1 => 0.08f, 2 => 0.12f, 3 => 0.16f, 4 => 0.33f, 5 => 0.38f, 6 => 0.44f, 7 => 0.5f, 8 => 0.55f, 9 => 0.28f, 10 => 0.6f, _ => 0.08f, }; if (baseTier == 9) { float num2 = num; if (isUndead) { num2 += (isTamed ? 0.08f : 0.1f); } return Mathf.Clamp01(num2); } float num3 = num; if (isCataclysmic) { num3 += 0.08f; } if (isUndead) { num3 += (isTamed ? 0.08f : 0.1f); } return Mathf.Clamp01(num3); } public static float ComputeCombinedMultiplier(float tierRed, float compMitigation) { float num = Mathf.Clamp01(1f - tierRed); float num2 = Mathf.Clamp01(1f - compMitigation); return num * num2; } public static float ComputePhysicalCorrectionFactor(float combinedTierRed, int defPoints, float mmoBonus, float equippedArmor, bool isUndead, bool isTamed) { return UndeadMitigationCap.ComputePhysicalCorrectionFactor(combinedTierRed, defPoints, mmoBonus, equippedArmor, isTamed, isUndead); } } public sealed class HarmonizationSimulationReport { public bool IsValid { get; set; } public string ErrorMessage { get; set; } public CataclysmicClassification OriginalClassification { get; set; } public bool IsUndead { get; set; } public string EventName { get; set; } public string EventDisplayName { get; set; } public int CurrentLegacyTier { get; set; } public int TargetBiologicalTier { get; set; } public string TargetTierName { get; set; } public float NativeBaseHealth { get; set; } public int WildLevel { get; set; } public int RpgHealthPoints { get; set; } public float CurrentHealthMult { get; set; } public float CurrentDamageMult { get; set; } public float CurrentTierReduction { get; set; } public float CurrentSpeedMult { get; set; } public float CurrentEstimatedMaxHp { get; set; } public float ProjectedHealthMult { get; set; } public float ProjectedDamageMult { get; set; } public float ProjectedTierReduction { get; set; } public float ProjectedSpeedMult { get; set; } public float ProjectedEstimatedMaxHp { get; set; } public float DeltaHealthMult => ProjectedHealthMult - CurrentHealthMult; public float DeltaDamageMult => ProjectedDamageMult - CurrentDamageMult; public float DeltaTierReduction => ProjectedTierReduction - CurrentTierReduction; public float DeltaSpeedMult => ProjectedSpeedMult - CurrentSpeedMult; public float DeltaEstimatedMaxHp => ProjectedEstimatedMaxHp - CurrentEstimatedMaxHp; public bool TriggersP05CapNoArmor { get; set; } public bool TriggersP05CapWithArmor { get; set; } public float EffectivePhysicalMitigationNoArmor { get; set; } public float EffectivePhysicalMitigationWithArmor { get; set; } public string EpistemicNotice { get; set; } public bool StarsPreserved { get; set; } public bool ExperiencePreserved { get; set; } public bool RpgStatsPreserved { get; set; } public bool SaddlebagsPreserved { get; set; } public bool CustomNamePreserved { get; set; } public bool MasteriesPreserved { get; set; } public bool CurrentHealthRatioPreserved { get; set; } public bool IsSimulationMode { get; set; } public bool LiveWriteExecuted { get; set; } public bool GuidPersistedDuringSimulation { get; set; } public bool HasAuthority { get; set; } public string FormatUserReadableReport() { if (!IsValid) { return "[ERROR EN RITUAL] " + (ErrorMessage ?? "Entrada inválida."); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("=== REPORTE DE SIMULACIÓN DE ARMONIZACIÓN CATACLÍSMICA ==="); stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "Estado Actual: {0} (Tier Legado {1})", OriginalClassification, CurrentLegacyTier)); stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "Tier Base a Armonizar: {0} (Tier {1})", TargetTierName, TargetBiologicalTier)); stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "Afinidad Elemental: {0} ({1})", EventDisplayName, EventName)); if (IsUndead) { stringBuilder.AppendLine("Estado No-Muerto: COEXISTE (Híbrido Cataclysmic + Undead)"); } stringBuilder.AppendLine(); stringBuilder.AppendLine("--- COMPARATIVA DE MULTIPLICADORES Y SALUD REAL ---"); stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "Salud Mult: x{0:F3} -> x{1:F3} (Delta: {2:+0.000;-0.000})", CurrentHealthMult, ProjectedHealthMult, DeltaHealthMult)); stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "Salud Máx: {0:F0} HP -> {1:F0} HP (Delta: {2:+0;-0} HP)", CurrentEstimatedMaxHp, ProjectedEstimatedMaxHp, DeltaEstimatedMaxHp)); stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "Daño: x{0:F2} -> x{1:F2} (Delta: {2:+0.00;-0.00})", CurrentDamageMult, ProjectedDamageMult, DeltaDamageMult)); stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "Mitigación: {0:P0} -> {1:P0} (Delta: {2:+0.0%;-0.0%})", CurrentTierReduction, ProjectedTierReduction, DeltaTierReduction)); stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "Velocidad: x{0:F3} -> x{1:F3} (Delta: {2:+0.000;-0.000})", CurrentSpeedMult, ProjectedSpeedMult, DeltaSpeedMult)); stringBuilder.AppendLine(); if (IsUndead) { stringBuilder.AppendLine("--- CONTROL DE TOPE FÍSICO P-05 (UNDEAD) ---"); stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "Mitigación Física Sin Alforjas: {0:P0} (Tope Máx: 75%) [Cap Activo: {1}]", EffectivePhysicalMitigationNoArmor, TriggersP05CapNoArmor ? "SÍ" : "NO")); stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "Mitigación Física Con Alforjas: {0:P0} (Tope Máx: 80%) [Cap Activo: {1}]", EffectivePhysicalMitigationWithArmor, TriggersP05CapWithArmor ? "SÍ" : "NO")); stringBuilder.AppendLine(); } stringBuilder.AppendLine("--- GARANTÍAS DE PRESERVACIÓN 1:1 ---"); stringBuilder.AppendLine(string.Format("- Estrellas (Nivel salvaje): {0}", StarsPreserved ? "PRESERVADO 100%" : "ALERTA")); stringBuilder.AppendLine(string.Format("- Nivel y XP de Compañero: {0}", ExperiencePreserved ? "PRESERVADO 100%" : "ALERTA")); stringBuilder.AppendLine(string.Format("- Atributos RPG Asignados: {0}", RpgStatsPreserved ? "PRESERVADO 100%" : "ALERTA")); stringBuilder.AppendLine(string.Format("- Alforjas e Inventario: {0}", SaddlebagsPreserved ? "PRESERVADO 100%" : "ALERTA")); stringBuilder.AppendLine(string.Format("- Nombre y Vínculo: {0}", CustomNamePreserved ? "PRESERVADO 100%" : "ALERTA")); stringBuilder.AppendLine(string.Format("- Maestrías y Pasivas: {0}", MasteriesPreserved ? "PRESERVADO 100%" : "ALERTA")); stringBuilder.AppendLine(string.Format("- Ratio de Salud Actual (%): {0}", CurrentHealthRatioPreserved ? "PRESERVADO 100%" : "ALERTA")); stringBuilder.AppendLine(); stringBuilder.AppendLine("--- ADVERTENCIA EPISTÉMICA ---"); stringBuilder.AppendLine(EpistemicNotice); stringBuilder.AppendLine(); stringBuilder.AppendLine(string.Format("MODO: {0} | ESCRITURA EN ZDO: {1}", IsSimulationMode ? "SIMULACIÓN ESTRICTA (DRY-RUN)" : "EN VIVO", LiveWriteExecuted ? "EJECUTADA" : "BLOQUEADA (0 ESCRITURAS)")); stringBuilder.AppendLine("=========================================================="); return stringBuilder.ToString(); } } public sealed class PendingRitualTicket { public string TicketId { get; set; } public long WorldUid { get; set; } public string CompanionGuid { get; set; } public int PrefabHash { get; set; } public int TargetBiologicalTier { get; set; } public string PreStateSha256 { get; set; } public string RequestingPlayerId { get; set; } public DateTime CreatedAtUtc { get; set; } public DateTime ExpiresAtUtc { get; set; } public bool IsConsumed { get; set; } public HarmonizationSimulationReport SimulationReport { get; set; } public bool IsValidAndActive(DateTime nowUtc) { if (!IsConsumed) { return nowUtc <= ExpiresAtUtc; } return false; } } public static class CataclysmicHarmonizationRitual { public const string StandardEpistemicDisclaimer = "Aviso de Linaje: Esta armonización representa una elección de invocación del jugador, no la reconstrucción de un registro histórico demostrado. Los guardados legados 0.7.52/0.7.53 consolidaban a la criatura en Tier 9 sin conservar el tier biológico previo a la tormenta."; private static bool s_reflectionInitialized = false; private static MethodInfo s_coreHealthMultMethod; private static MethodInfo s_coreDamageMultMethod; private static MethodInfo s_coreReductionMethod; private static MethodInfo s_coreSpeedMultMethod; private static Type s_creatureTierEnumType; public static bool StrictSimulationOnly { get { return true; } set { } } private static void EnsureCoreEngineBindings() { if (s_reflectionInitialized) { return; } s_reflectionInitialized = true; try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (assembly == null) { continue; } string name = assembly.GetName().Name; if (string.Equals(name, "TameMate", StringComparison.OrdinalIgnoreCase)) { Type type = assembly.GetType("TameMate.SupremeTierEngine", throwOnError: false); s_creatureTierEnumType = assembly.GetType("TameMate.CreatureTier", throwOnError: false); if (type != null && s_creatureTierEnumType != null) { s_coreHealthMultMethod = type.GetMethod("GetTierHealthMultiplier", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { s_creatureTierEnumType }, null); s_coreDamageMultMethod = type.GetMethod("GetTierDamageMultiplier", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { s_creatureTierEnumType }, null); s_coreReductionMethod = type.GetMethod("GetTierDamageReduction", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { s_creatureTierEnumType }, null); s_coreSpeedMultMethod = type.GetMethod("GetTierSpeedMultiplier", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { s_creatureTierEnumType }, null); } break; } } } catch { } } public static HarmonizationSimulationReport SimulateHarmonization(IZdoPropertyReader reader, int targetBaseTier, bool hasWriteAuthority = true, float nativeBaseHealth = 1000f) { HarmonizationSimulationReport harmonizationSimulationReport = new HarmonizationSimulationReport(); harmonizationSimulationReport.IsSimulationMode = true; harmonizationSimulationReport.LiveWriteExecuted = false; harmonizationSimulationReport.GuidPersistedDuringSimulation = false; harmonizationSimulationReport.HasAuthority = hasWriteAuthority; harmonizationSimulationReport.EpistemicNotice = "Aviso de Linaje: Esta armonización representa una elección de invocación del jugador, no la reconstrucción de un registro histórico demostrado. Los guardados legados 0.7.52/0.7.53 consolidaban a la criatura en Tier 9 sin conservar el tier biológico previo a la tormenta."; HarmonizationSimulationReport harmonizationSimulationReport2 = harmonizationSimulationReport; if (reader == null) { harmonizationSimulationReport2.IsValid = false; harmonizationSimulationReport2.ErrorMessage = "ZDO nulo o inválido."; return harmonizationSimulationReport2; } CataclysmicClassification cataclysmicClassification = CataclysmicStateReader.Classify(reader); if (cataclysmicClassification != CataclysmicClassification.LegacyAmbiguous && cataclysmicClassification != CataclysmicClassification.LegacyAmbiguousUndead) { harmonizationSimulationReport2.IsValid = false; harmonizationSimulationReport2.ErrorMessage = $"La criatura no es un Cataclysmic legado apto para armonización (Clasificación: {cataclysmicClassification})."; return harmonizationSimulationReport2; } if (targetBaseTier < 1 || targetBaseTier > 10 || targetBaseTier == 9) { harmonizationSimulationReport2.IsValid = false; harmonizationSimulationReport2.ErrorMessage = $"El tier destino {targetBaseTier} no es un tier biológico válido para armonización."; return harmonizationSimulationReport2; } bool flag = CataclysmicStateReader.IsUndead(reader); string eventName = reader.GetString(CataclysmicStateReader.SavedEventKey); int num = Math.Max(1, reader.GetInt(CataclysmicStateReader.WildLevelKey, 3)); int num2 = Math.Max(0, reader.GetInt(CataclysmicStateReader.StatHealthKey)); float num3 = ((nativeBaseHealth > 0f) ? nativeBaseHealth : 1000f); harmonizationSimulationReport2.IsValid = true; harmonizationSimulationReport2.OriginalClassification = cataclysmicClassification; harmonizationSimulationReport2.IsUndead = flag; harmonizationSimulationReport2.EventName = eventName; harmonizationSimulationReport2.EventDisplayName = CataclysmicHudFormatter.GetEventDisplayName(eventName); harmonizationSimulationReport2.CurrentLegacyTier = 9; harmonizationSimulationReport2.TargetBiologicalTier = targetBaseTier; harmonizationSimulationReport2.TargetTierName = CataclysmicHudFormatter.GetTierName(targetBaseTier); harmonizationSimulationReport2.NativeBaseHealth = num3; harmonizationSimulationReport2.WildLevel = num; harmonizationSimulationReport2.RpgHealthPoints = num2; float num4 = ComputeTamedSpecialTierStat(2f, 9, flag, 0); float currentDamageMult = ComputeTamedSpecialTierStat(1.85f, 9, flag, 1); float currentTierReduction = ComputeTamedSpecialTierStat(0.25f, 9, flag, 2); float currentSpeedMult = ComputeTamedSpecialTierStat(1.2f, 9, flag, 3); harmonizationSimulationReport2.CurrentHealthMult = num4; harmonizationSimulationReport2.CurrentDamageMult = currentDamageMult; harmonizationSimulationReport2.CurrentTierReduction = currentTierReduction; harmonizationSimulationReport2.CurrentSpeedMult = currentSpeedMult; harmonizationSimulationReport2.CurrentEstimatedMaxHp = num3 * (float)num * num4 * (1f + (float)num2 * 0.05f); float biologicalTierHealthMultiplier = GetBiologicalTierHealthMultiplier(targetBaseTier); float biologicalTierDamageMultiplier = GetBiologicalTierDamageMultiplier(targetBaseTier); float biologicalTierReduction = GetBiologicalTierReduction(targetBaseTier); float biologicalTierSpeedMultiplier = GetBiologicalTierSpeedMultiplier(targetBaseTier); float num5 = ComputeTamedSpecialTierStat(biologicalTierHealthMultiplier, targetBaseTier, flag, 0); float projectedDamageMult = ComputeTamedSpecialTierStat(biologicalTierDamageMultiplier, targetBaseTier, flag, 1); float num6 = ComputeTamedSpecialTierStat(biologicalTierReduction, targetBaseTier, flag, 2); float projectedSpeedMult = ComputeTamedSpecialTierStat(biologicalTierSpeedMultiplier, targetBaseTier, flag, 3); float projectedTierReduction = Mathf.Clamp01(num6 + 0.08f); harmonizationSimulationReport2.ProjectedHealthMult = num5; harmonizationSimulationReport2.ProjectedDamageMult = projectedDamageMult; harmonizationSimulationReport2.ProjectedTierReduction = projectedTierReduction; harmonizationSimulationReport2.ProjectedSpeedMult = projectedSpeedMult; harmonizationSimulationReport2.ProjectedEstimatedMaxHp = num3 * (float)num * num5 * (1f + (float)num2 * 0.05f); if (flag) { harmonizationSimulationReport2.TriggersP05CapNoArmor = harmonizationSimulationReport2.ProjectedTierReduction > 0.75f; harmonizationSimulationReport2.EffectivePhysicalMitigationNoArmor = Mathf.Min(0.75f, harmonizationSimulationReport2.ProjectedTierReduction); float num7 = 1f - (1f - harmonizationSimulationReport2.ProjectedTierReduction) * 0.9f; harmonizationSimulationReport2.TriggersP05CapWithArmor = num7 > 0.8f; harmonizationSimulationReport2.EffectivePhysicalMitigationWithArmor = Mathf.Min(0.8f, num7); } else { harmonizationSimulationReport2.TriggersP05CapNoArmor = false; harmonizationSimulationReport2.TriggersP05CapWithArmor = false; harmonizationSimulationReport2.EffectivePhysicalMitigationNoArmor = harmonizationSimulationReport2.ProjectedTierReduction; harmonizationSimulationReport2.EffectivePhysicalMitigationWithArmor = harmonizationSimulationReport2.ProjectedTierReduction; } harmonizationSimulationReport2.StarsPreserved = true; harmonizationSimulationReport2.ExperiencePreserved = true; harmonizationSimulationReport2.RpgStatsPreserved = true; harmonizationSimulationReport2.SaddlebagsPreserved = true; harmonizationSimulationReport2.CustomNamePreserved = true; harmonizationSimulationReport2.MasteriesPreserved = true; harmonizationSimulationReport2.CurrentHealthRatioPreserved = true; return harmonizationSimulationReport2; } public static float ComputeTamedSpecialTierStat(float original, int tier, bool undead, int kind) { if (tier != 9 && !undead) { return original; } float num = original; if (tier == 9) { num = kind switch { 2 => 0.28f, 1 => 1.92f, 0 => 2.4f, _ => 1.2f, }; } if (undead) { num = kind switch { 2 => Math.Min(0.7f, num + 0.08f), 1 => num * 1.25f, 0 => num * 1.35f, _ => num * 1.06f, }; } return num; } public static PendingRitualTicket PrepareHarmonizationTicket(IZdoPropertyReader reader, int targetBaseTier, string requestingPlayerId, long worldUid, int prefabHash, float nativeBaseHealth = 1000f, bool hasWriteAuthority = true) { if (reader == null) { return null; } HarmonizationSimulationReport harmonizationSimulationReport = SimulateHarmonization(reader, targetBaseTier, hasWriteAuthority, nativeBaseHealth); ISyntheticZdoPropertyWriter syntheticZdoPropertyWriter = reader as ISyntheticZdoPropertyWriter; if (syntheticZdoPropertyWriter != null && syntheticZdoPropertyWriter.IsBoss) { harmonizationSimulationReport.IsValid = false; harmonizationSimulationReport.ErrorMessage = "Operación bloqueada en criaturas tipo jefe (Boss)."; } else if ((syntheticZdoPropertyWriter != null && !syntheticZdoPropertyWriter.IsTamed) || reader.GetInt(CataclysmicStateReader.TamedBoolKey, 1) == 0) { harmonizationSimulationReport.IsValid = false; harmonizationSimulationReport.ErrorMessage = "Operación bloqueada en criaturas salvajes (no domesticadas)."; } else { string text = reader.GetString(CataclysmicStateReader.OwnerIdKey, string.Empty); if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(requestingPlayerId) && !string.Equals(text, requestingPlayerId, StringComparison.OrdinalIgnoreCase)) { harmonizationSimulationReport.IsValid = false; harmonizationSimulationReport.ErrorMessage = "El jugador solicitante no tiene permisos de propietario sobre el compañero."; } } CompanionZdoSnapshot companionZdoSnapshot = CompanionZdoSnapshot.CreateFromReader(reader, worldUid, 0L, 0u, prefabHash); string preStateSha = ((companionZdoSnapshot != null) ? companionZdoSnapshot.ComputeSessionIndependentContentSha256() : string.Empty); string text2 = reader.GetString(CataclysmicStateReader.CompanionGuidKey, string.Empty); if (!CataclysmicStateReader.IsValidCompanionGuid(text2)) { text2 = CataclysmicStateReader.GenerateCompanionGuid(); } DateTime utcNow = DateTime.UtcNow; PendingRitualTicket pendingRitualTicket = new PendingRitualTicket(); pendingRitualTicket.TicketId = "TKT_" + Guid.NewGuid().ToString("N").Substring(0, 16); pendingRitualTicket.WorldUid = worldUid; pendingRitualTicket.CompanionGuid = text2; pendingRitualTicket.PrefabHash = prefabHash; pendingRitualTicket.TargetBiologicalTier = targetBaseTier; pendingRitualTicket.PreStateSha256 = preStateSha; pendingRitualTicket.RequestingPlayerId = requestingPlayerId ?? string.Empty; pendingRitualTicket.CreatedAtUtc = utcNow; pendingRitualTicket.ExpiresAtUtc = utcNow.AddSeconds(60.0); pendingRitualTicket.IsConsumed = false; pendingRitualTicket.SimulationReport = harmonizationSimulationReport; return pendingRitualTicket; } public static bool TryExecuteHarmonization(IZdoPropertyReader reader, int targetBaseTier, out HarmonizationSimulationReport report, out string statusMessage) { return TryExecuteHarmonization(reader, targetBaseTier, hasWriteAuthority: true, 1000f, out report, out statusMessage); } public static bool TryExecuteHarmonization(IZdoPropertyReader reader, int targetBaseTier, bool hasWriteAuthority, float nativeBaseHealth, out HarmonizationSimulationReport report, out string statusMessage) { report = SimulateHarmonization(reader, targetBaseTier, hasWriteAuthority, nativeBaseHealth); if (!report.IsValid) { statusMessage = report.ErrorMessage; return false; } statusMessage = "[SIMULACIÓN ACTIVA] El ritual operó en modo simulación dry-run (Etapa 4B-2B.1). No se realizaron escrituras en ZDO ni en disco."; return true; } public static bool TryConfirmHarmonization(IZdoPropertyReader reader, int targetBaseTier, out string statusMessage) { statusMessage = "[BLOQUEADO EN 4B-2B.1] Confirm sobre ZDO real de Valheim deshabilitado hasta la Etapa 4B-2B.2 (0 escrituras realizadas)."; return false; } public static bool TryCommitHarmonization(ZDO liveZdo, int targetBaseTier, out string statusMessage) { statusMessage = "[BLOQUEADO EN 4B-2B.1] Commit sobre ZDO real de Valheim deshabilitado hasta la Etapa 4B-2B.2 (0 escrituras realizadas)."; return false; } public static bool TryRollbackHarmonization(ZDO liveZdo, out string statusMessage) { statusMessage = "[BLOQUEADO EN 4B-2B.1] Rollback sobre ZDO real de Valheim deshabilitado hasta la Etapa 4B-2B.2 (0 escrituras realizadas)."; return false; } public static bool ConfirmAndExecuteSyntheticHarmonization(ISyntheticZdoPropertyWriter writer, PendingRitualTicket ticket, int confirmedTargetTier, string confirmingPlayerId, IEnumerable<IZdoPropertyReader> worldZdos, ZdoInspectionScope scope, bool hasWriteAuthority, out string statusMessage) { statusMessage = null; if (writer == null || !writer.IsSyntheticTestFixture) { statusMessage = "[BLOQUEADO EN 4B-2A] Solo se admiten fixtures de prueba sintéticos en 4B-2A. Operaciones sobre criaturas reales de Valheim deshabilitadas."; return false; } return BackupAndCommit(writer, ticket, confirmedTargetTier, confirmingPlayerId, worldZdos, scope, hasWriteAuthority, out statusMessage); } internal static bool BackupAndCommit(IRitualTransactionWriter writer, PendingRitualTicket ticket, int confirmedTargetTier, string confirmingPlayerId, IEnumerable<IZdoPropertyReader> worldZdos, ZdoInspectionScope scope, bool hasWriteAuthority, out string statusMessage) { statusMessage = null; RitualGuardedWriter ritualGuardedWriter = writer as RitualGuardedWriter; ISyntheticZdoPropertyWriter syntheticZdoPropertyWriter = writer as ISyntheticZdoPropertyWriter; if (ritualGuardedWriter == null && (syntheticZdoPropertyWriter == null || !syntheticZdoPropertyWriter.IsSyntheticTestFixture)) { statusMessage = "Transaction writer is not authorized."; return false; } ritualGuardedWriter?.Checkpoint(); if (ticket == null) { statusMessage = "Fallo de confirmación: ticket de ritual nulo o no preparado previamente."; return false; } if (ticket.IsConsumed) { statusMessage = "Fallo de confirmación: el ticket de ritual ya fue consumido o invalidado previamente (uso único)."; return false; } ticket.IsConsumed = true; if (DateTime.UtcNow > ticket.ExpiresAtUtc) { statusMessage = string.Format(CultureInfo.InvariantCulture, "Fallo de confirmación: el ticket de ritual ha expirado (expiró en {0:o}, actual {1:o}).", ticket.ExpiresAtUtc, DateTime.UtcNow); return false; } if (confirmedTargetTier != ticket.TargetBiologicalTier) { statusMessage = string.Format(CultureInfo.InvariantCulture, "Discrepancia de tier: el tier confirmado ({0}) difiere del tier preparado en el ticket ({1}).", confirmedTargetTier, ticket.TargetBiologicalTier); return false; } if (!string.Equals(confirmingPlayerId, ticket.RequestingPlayerId, StringComparison.OrdinalIgnoreCase)) { statusMessage = string.Format(CultureInfo.InvariantCulture, "Discrepancia de jugador: el confirmante '{0}' no coincide con el solicitante '{1}'.", confirmingPlayerId, ticket.RequestingPlayerId); return false; } if (!hasWriteAuthority) { statusMessage = "Fallo de confirmación: pérdida de autoridad de red (hasWriteAuthority == false)."; return false; } if (writer.IsBoss) { statusMessage = "Operación bloqueada en criaturas tipo jefe."; return false; } if (!writer.IsTamed || writer.GetInt(CataclysmicStateReader.TamedBoolKey, 1) == 0) { statusMessage = "Operación bloqueada en criaturas no domesticadas (salvajes)."; return false; } string text = writer.GetString(CataclysmicStateReader.OwnerIdKey, string.Empty); if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(confirmingPlayerId) && !string.Equals(text, confirmingPlayerId, StringComparison.OrdinalIgnoreCase)) { statusMessage = "Operación bloqueada: el jugador confirmante no tiene permisos de propietario sobre el compañero."; return false; } long num = writer.GetLong(CataclysmicStateReader.CompanionWorldUidKey, 0L); if (num != 0 && num != ticket.WorldUid) { statusMessage = string.Format(CultureInfo.InvariantCulture, "Discrepancia de WorldUid: el ZDO registra {0}, pero el ticket corresponde a {1}.", num, ticket.WorldUid); return false; } CompanionZdoSnapshot companionZdoSnapshot = CompanionZdoSnapshot.CreateFromReader(writer, ticket.WorldUid, 0L, 0u, ticket.PrefabHash); string text2 = companionZdoSnapshot.ComputeSessionIndependentContentSha256(); if (!string.Equals(text2, ticket.PreStateSha256, StringComparison.OrdinalIgnoreCase)) { statusMessage = string.Format(CultureInfo.InvariantCulture, "Discrepancia de estado pre-ritual: el hash actual ({0}) difiere del hash preparado ({1}). El estado fue modificado antes de confirmar.", text2, ticket.PreStateSha256); return false; } string text3 = writer.GetString(CataclysmicStateReader.CompanionGuidKey, string.Empty); if (!CataclysmicStateReader.IsValidCompanionGuid(text3)) { text3 = ticket.CompanionGuid; if (!CataclysmicStateReader.IsValidCompanionGuid(text3)) { text3 = CataclysmicStateReader.GenerateCompanionGuid(); } writer.SetString(CataclysmicStateReader.CompanionGuidKey, text3); writer.SetLong(CataclysmicStateReader.CompanionWorldUidKey, ticket.WorldUid); writer.SetInt(CataclysmicStateReader.CompanionPrefabHashKey, ticket.PrefabHash); } CompanionIdentityResolution companionIdentityResolution = CataclysmicStateReader.ResolveCompanionIdentity(text3, ticket.WorldUid, ticket.PrefabHash, worldZdos, scope); if (!companionIdentityResolution.IsUnambiguousAndSafe || !companionIdentityResolution.IsGlobalUniquenessProven) { statusMessage = "Fallo de validación de identidad y alcance: " + (companionIdentityResolution.FailureReason ?? "Identidad ambigua o alcance no verificado."); return false; } CompanionZdoSnapshot companionZdoSnapshot2 = CompanionZdoSnapshot.CreateFromReader(writer, ticket.WorldUid, 0L, 0u, ticket.PrefabHash); string outPath; string statusMessage2; WriteOnceBackupStatus writeOnceBackupStatus = CompanionPersistentBackup.SaveLegacyOriginBackupWriteOnce(companionZdoSnapshot2, "RitualHarmonization_4B2A", out outPath, out statusMessage2); if (writeOnceBackupStatus != WriteOnceBackupStatus.CreatedNewVerified && writeOnceBackupStatus != WriteOnceBackupStatus.AlreadyExistsVerified) { statusMessage = "Fallo crítico al crear/verificar el respaldo Write-Once legacy_origin: " + statusMessage2; return false; } string legacyOriginSha = companionZdoSnapshot2.ComputeSessionIndependentContentSha256(); if (ritualGuardedWriter != null) { string error; CompanionZdoSnapshot companionZdoSnapshot3 = CompanionPersistentBackup.LoadLegacyOriginBackup(ticket.WorldUid, text3, ticket.PrefabHash, out error); if (companionZdoSnapshot3 == null) { statusMessage = error; return false; } legacyOriginSha = companionZdoSnapshot3.ComputeSessionIndependentContentSha256(); } RitualTransactionJournal ritualTransactionJournal = new RitualTransactionJournal(); ritualTransactionJournal.TransactionId = ticket.TicketId; ritualTransactionJournal.WorldUid = ticket.WorldUid; ritualTransactionJournal.CompanionGuid = text3; ritualTransactionJournal.PrefabHash = ticket.PrefabHash; ritualTransactionJournal.TargetBaseTier = confirmedTargetTier; ritualTransactionJournal.State = RitualJournalState.BackupVerified; ritualTransactionJournal.LegacyOriginSha256 = legacyOriginSha; ritualTransactionJournal.PreStateSha256 = ticket.PreStateSha256; ritualTransactionJournal.TimestampUtc = DateTime.UtcNow.ToString("o"); RitualTransactionJournal ritualTransactionJournal2 = ritualTransactionJournal; ritualGuardedWriter?.Checkpoint(); if (!CompanionPersistentBackup.SaveJournal(ritualTransactionJournal2, out var outPath2, out var error2)) { statusMessage = "Fallo al guardar journal BackupVerified: " + error2; return false; } if (writer.MidWriteFaultInjector != null) { writer.MidWriteFaultInjector(1, "PreMutationFault"); } ritualTransactionJournal2.State = RitualJournalState.ZdoMutating; ritualGuardedWriter?.Checkpoint(); if (!CompanionPersistentBackup.SaveJournal(ritualTransactionJournal2, out outPath2, out error2)) { statusMessage = "Fallo al actualizar journal a ZdoMutating: " + error2; return false; } writer.SetInt(CataclysmicStateReader.RitualTxStateKey, 1); if (writer.MidWriteFaultInjector != null) { writer.MidWriteFaultInjector(2, "MidMutationFault"); } writer.SetInt(CataclysmicStateReader.SavedTierKey, confirmedTargetTier); writer.SetInt(CataclysmicStateReader.TierOverrideKey, confirmedTargetTier); writer.SetInt(CataclysmicStateReader.IsCataclysmicKey, 1); writer.SetString(CataclysmicStateReader.RitualTxIdKey, ticket.TicketId); writer.SetInt(CataclysmicStateReader.HarmonizedFromLegacyKey, 1); writer.SetInt(CataclysmicStateReader.HarmonizedTargetTierKey, confirmedTargetTier); writer.SetString(CataclysmicStateReader.HarmonizedTimestampKey, DateTime.UtcNow.ToString("o")); writer.SetInt(CataclysmicStateReader.RitualTxStateKey, 2); float num2; if (ritualGuardedWriter != null) { ritualGuardedWriter.RefreshDerivedState(); num2 = ritualGuardedWriter.EffectiveMaxHealth; if (float.IsNaN(num2) || float.IsInfinity(num2) || Math.Abs(num2 - ticket.SimulationReport.ProjectedEstimatedMaxHp) > 0.5f) { statusMessage = "El recálculo nativo no coincide con la proyección; cuarentena."; return false; } } else { writer.SetInt(CataclysmicStateReader.TierHpInitKey, 1); bool flag = CataclysmicStateReader.IsUndead((IZdoPropertyReader)writer); int value = ((flag || confirmedTargetTier == 9) ? (10100 + confirmedTargetTier + (flag ? 1000 : 0)) : 0); writer.SetInt(CataclysmicStateReader.SpecialProfileKey, value); float num3 = ((writer.NativeBaseHealth > 0f) ? writer.NativeBaseHealth : 1000f); int num4 = Math.Max(1, writer.GetInt(CataclysmicStateReader.WildLevelKey, 3)); int num5 = Math.Max(0, writer.GetInt(CataclysmicStateReader.StatHealthKey)); float num6 = writer.GetFloat(CataclysmicStateReader.MaxHealthKey); float num7 = writer.GetFloat(CataclysmicStateReader.HealthKey, num6); float num8 = ((num6 > 0f) ? Mathf.Clamp01(num7 / num6) : 1f); float num9 = ComputeTamedSpecialTierStat(GetBiologicalTierHealthMultiplier(confirmedTargetTier), confirmedTargetTier, flag, 0); num2 = num3 * (float)num4 * num9 * (1f + (float)num5 * 0.05f); writer.SetFloat(CataclysmicStateReader.MaxHealthKey, num2); writer.SetFloat(CataclysmicStateReader.HealthKey, Mathf.Clamp(num2 * num8, 1f, num2)); } CompanionZdoSnapshot companionZdoSnapshot4 = CompanionZdoSnapshot.CreateFromReader(writer, ticket.WorldUid, 0L, 0u, ticket.PrefabHash); if (!CataclysmicStateReader.VerifySubsetCUnchanged(companionZdoSnapshot2, companionZdoSnapshot4, out var diffReason)) { statusMessage = "Violación de integridad: Subconjunto C modificado durante la armonización: " + diffReason; return false; } CataclysmicClassification cataclysmicClassification = CataclysmicStateReader.Classify((IZdoPropertyReader)writer); int effectiveBaseTier = CataclysmicStateReader.GetEffectiveBaseTier((IZdoPropertyReader)writer); if (cataclysmicClassification != CataclysmicClassification.DecoupledCataclysmic || effectiveBaseTier != confirmedTargetTier) { statusMessage = string.Format(CultureInfo.InvariantCulture, "Fallo de post-verificación: estado esperado DecoupledCataclysmic Tier {0}, pero se obtuvo {1} Tier {2}.", confirmedTargetTier, cataclysmicClassification, effectiveBaseTier); return false; } ritualTransactionJournal2.State = ((ritualGuardedWriter != null) ? RitualJournalState.CommittedInMemory : RitualJournalState.Committed); ritualTransactionJournal2.PostStateSha256 = companionZdoSnapshot4.ComputeSessionIndependentContentSha256(); ritualGuardedWriter?.Checkpoint(); if (!CompanionPersistentBackup.SaveJournal(ritualTransactionJournal2, out outPath2, out error2)) { statusMessage = "Fallo al finalizar journal a Committed: " + error2; return false; } statusMessage = string.Format(CultureInfo.InvariantCulture, "Armonización sintética exitosa: compañero GUID={0} armonizado a DecoupledCataclysmic Tier {1} ({2:F0} HP). Subconjunto C 100% preservado.", text3, confirmedTargetTier, num2); return true; } public static bool RollbackLineageOnlySynthetic(ISyntheticZdoPropertyWriter writer, long worldUid, int prefabHash, IEnumerable<IZdoPropertyReader> worldZdos, ZdoInspectionScope scope, string requestingPlayerId, bool hasWriteAuthority, out string statusMessage) { statusMessage = null; if (writer == null || !writer.IsSyntheticTestFixture) { statusMessage = "[BLOQUEADO EN 4B-2A] Solo se admiten fixtures sintéticos en 4B-2A."; return false; } return RollbackLineageOnly(writer, worldUid, prefabHash, worldZdos, scope, requestingPlayerId, hasWriteAuthority, out statusMessage); } internal static bool RollbackLineageOnly(IRitualTransactionWriter writer, long worldUid, int prefabHash, IEnumerable<IZdoPropertyReader> worldZdos, ZdoInspectionScope scope, string requestingPlayerId, bool hasWriteAuthority, out string statusMessage) { statusMessage = null; RitualGuardedWriter ritualGuardedWriter = writer as RitualGuardedWriter; ISyntheticZdoPropertyWriter syntheticZdoPropertyWriter = writer as ISyntheticZdoPropertyWriter; if (ritualGuardedWriter == null && (syntheticZdoPropertyWriter == null || !syntheticZdoPropertyWriter.IsSyntheticTestFixture)) { statusMessage = "Transaction writer is not authorized."; return false; } ritualGuardedWriter?.Checkpoint(); if (!hasWriteAuthority) { statusMessage = "Rollback abortado: falta de autoridad de red (hasWriteAuthority == false)."; return false; } string text = writer.GetString(CataclysmicStateReader.OwnerIdKey, string.Empty); if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(requestingPlayerId) && !string.Equals(text, requestingPlayerId, StringComparison.OrdinalIgnoreCase)) { statusMessage = "Rollback abortado: el jugador no es el propietario del compañero."; return false; } string text2 = writer.GetString(CataclysmicStateReader.CompanionGuidKey, string.Empty); CompanionIdentityResolution companionIdentityResolution = CataclysmicStateReader.ResolveCompanionIdentity(text2, worldUid, prefabHash, worldZdos, scope); if (!companionIdentityResolution.IsUnambiguousAndSafe || !companionIdentityResolution.IsGlobalUniquenessProven) { statusMessage = "Rollback bloqueado por validación de identidad/alcance: " + (companionIdentityResolution.FailureReason ?? "Identidad no probada."); return false; } string error; CompanionZdoSnapshot companionZdoSnapshot = CompanionPersistentBackup.LoadLegacyOriginBackup(worldUid, text2, prefabHash, out error); if (companionZdoSnapshot == null || !companionZdoSnapshot.VerifyIntegrity()) { statusMessage = "Rollback bloqueado: no se encontró respaldo legacy_origin íntegro: " + error; return false; } CompanionZdoSnapshot companionZdoSnapshot2 = CompanionZdoSnapshot.CreateFromReader(writer, worldUid, 0L, 0u, prefabHash); string error2; RitualTransactionJournal ritualTransactionJournal = CompanionPersistentBackup.LoadJournal(worldUid, text2, out error2); if (ritualTransactionJournal == null) { RitualTransactionJournal ritualTransactionJournal2 = new RitualTransactionJournal(); ritualTransactionJournal2.TransactionId = "RBK_" + Guid.NewGuid().ToString("N").Substring(0, 16); ritualTransactionJournal2.WorldUid = worldUid; ritualTransactionJournal2.CompanionGuid = text2; ritualTransactionJournal2.PrefabHash = prefabHash; ritualTransactionJournal = ritualTransactionJournal2; } RitualTransactionJournal ritualTransactionJournal3 = ritualTransactionJournal; ritualTransactionJournal3.State = RitualJournalState.RecoveringLineage; if (ritualGuardedWriter != null) { ritualTransactionJournal3.TransactionId = ritualGuardedWriter.TransactionId; ritualTransactionJournal3.TargetBaseTier = 9; ritualTransactionJournal3.PreStateSha256 = companionZdoSnapshot2.ComputeSessionIndependentContentSha256(); ritualTransactionJournal3.LegacyOriginSha256 = companionZdoSnapshot.ComputeSessionIndependentContentSha256(); ritualTransactionJournal3.PostStateSha256 = string.Empty; } ritualGuardedWriter?.Checkpoint(); if (!CompanionPersistentBackup.SaveJournal(ritualTransactionJournal3, out var outPath, out error2)) { statusMessage = error2; return false; } writer.SetInt(CataclysmicStateReader.RitualTxStateKey, 3); float num; if (ritualGuardedWriter != null) { ritualGuardedWriter.RestoreOriginalLineage(companionZdoSnapshot); ritualGuardedWriter.RefreshDerivedState(); num = ritualGuardedWriter.EffectiveMaxHealth; } else { writer.SetInt(CataclysmicStateReader.SavedTierKey, 9); writer.SetInt(CataclysmicStateReader.TierOverrideKey, 9); writer.SetInt(CataclysmicStateReader.IsCataclysmicKey, 0); writer.SetInt(CataclysmicStateReader.RitualTxStateKey, 0); writer.SetInt(CataclysmicStateReader.HarmonizedFromLegacyKey, 0); writer.SetInt(CataclysmicStateReader.HarmonizedTargetTierKey, 0); writer.SetString(CataclysmicStateReader.HarmonizedTimestampKey, string.Empty); bool flag = CataclysmicStateReader.IsUndead((IZdoPropertyReader)writer); int value = 10109 + (flag ? 1000 : 0); writer.SetInt(CataclysmicStateReader.SpecialProfileKey, value); float num2 = ((writer.NativeBaseHealth > 0f) ? writer.NativeBaseHealth : 1000f); int num3 = Math.Max(1, writer.GetInt(CataclysmicStateReader.WildLevelKey, 3)); int num4 = Math.Max(0, writer.GetInt(CataclysmicStateReader.StatHealthKey)); float num5 = writer.GetFloat(CataclysmicStateReader.MaxHealthKey); float num6 = writer.GetFloat(CataclysmicStateReader.HealthKey, num5); float num7 = ((num5 > 0f) ? Mathf.Clamp01(num6 / num5) : 1f); float num8 = ComputeTamedSpecialTierStat(2f, 9, flag, 0); num = num2 * (float)num3 * num8 * (1f + (float)num4 * 0.05f); writer.SetFloat(CataclysmicStateReader.MaxHealthKey, num); writer.SetFloat(CataclysmicStateReader.HealthKey, Mathf.Clamp(num * num7, 1f, num)); } CompanionZdoSnapshot companionZdoSnapshot3 = CompanionZdoSnapshot.CreateFromReader(writer, worldUid, 0L, 0u, prefabHash); if (!CataclysmicStateReader.VerifySubsetCUnchanged(companionZdoSnapshot2, companionZdoSnapshot3, out var diffReason)) { statusMessage = "Violación de integridad durante rollback de linaje: Subconjunto C afectado: " + diffReason; return false; } CataclysmicClassification cataclysmicClassification = CataclysmicStateReader.Classify((IZdoPropertyReader)writer); if (cataclysmicClassification != CataclysmicClassification.LegacyAmbiguous && cataclysmicClassification != CataclysmicClassification.LegacyAmbiguousUndead) { statusMessage = "Fallo post-rollback: clasificación no volvió a LegacyAmbiguous: " + cataclysmicClassification; return false; } ritualTransactionJournal3.State = ((ritualGuardedWriter != null) ? RitualJournalState.RolledBackInMemory : RitualJournalState.RecoveredToLegacy); if (ritualGuardedWriter != null) { ritualTransactionJournal3.PostStateSha256 = companionZdoSnapshot3.ComputeSessionIndependentContentSha256(); } ritualGuardedWriter?.Checkpoint(); if (!CompanionPersistentBackup.SaveJournal(ritualTransactionJournal3, out outPath, out error2)) { statusMessage = error2; return false; } statusMessage = string.Format(CultureInfo.InvariantCulture, "Rollback sintético de linaje completado exitosamente: criatura restaurada a Tier 9 Legado ({0:F0} HP). Alforjas (items byte[]) e historial preservados.", num); return true; } public static bool RecoverInterruptedSynthetic(ISyntheticZdoPropertyWriter writer, long worldUid, int prefabHash, IEnumerable<IZdoPropertyReader> worldZdos, ZdoInspectionScope scope, out string statusMessage) { statusMessage = null; if (writer == null || !writer.IsSyntheticTestFixture) { statusMessage = "[BLOQUEADO EN 4B-2A] Solo se admiten fixtures sintéticos en 4B-2A."; return false; } InterruptionDiagnosis interruptionDiagnosis = CompanionPersistentBackup.InspectInterruptedTransaction(writer, worldUid, prefabHash); if (!interruptionDiagnosis.IsInterrupted) { statusMessage = "No se detectó ninguna interrupción que requiera recuperación."; return true; } if (interruptionDiagnosis.ScenarioType == InterruptionScenarioType.InterruptedAfterCommitBeforeWorldSave) { statusMessage = "[RECUPERACIÓN NO REQUERIDA] La criatura ya está intacta en estado Legado en el guardado del mundo. Cero escrituras destructivas ejecutadas."; return true; } if (interruptionDiagnosis.ScenarioType == InterruptionScenarioType.InterruptedBeforeCommit) { statusMessage = "[RECUPERACIÓN NO REQUERIDA] La criatura no fue mutada en el ZDO. Permanece intacta en estado Legado."; return true; } if (interruptionDiagnosis.ScenarioType == InterruptionScenarioType.InterruptedDuringWrite || interruptionDiagnosis.ScenarioType == InterruptionScenarioType.InterruptedDuringRecovery) { if (!interruptionDiagnosis.CanSafelyRecoverLineage) { statusMessage = "Recuperación bloqueada: no se cuenta con un respaldo Write-Once legacy_origin íntegro y verificado."; return false; } return RollbackLineageOnlySynthetic(writer, worldUid, prefabHash, worldZdos, scope, string.Empty, hasWriteAuthority: true, out statusMessage); } statusMessage = "Escenario de interrupción no accionable: " + interruptionDiagnosis.ScenarioType; return false; } public static float GetBiologicalTierHealthMultiplier(int tier) { EnsureCoreEngineBindings(); if (s_coreHealthMultMethod != null && s_creatureTierEnumType != null) { try { object obj = Enum.ToObject(s_creatureTierEnumType, tier); return (float)s_coreHealthMultMethod.Invoke(null, new object[1] { obj }); } catch { } } return tier switch { 1 => 1f, 2 => 1.35f, 3 => 1.7f, 4 => 2.1f, 5 => 2.6f, 6 => 3.2f, 7 => 3.9f, 8 => 4.8f, 10 => 5.5f, _ => 1f, }; } public static float GetBiologicalTierDamageMultiplier(int tier) { EnsureCoreEngineBindings(); if (s_coreDamageMultMethod != null && s_creatureTierEnumType != null) { try { object obj = Enum.ToObject(s_creatureTierEnumType, tier); return (float)s_coreDamageMultMethod.Invoke(null, new object[1] { obj }); } catch { } } return tier switch { 1 => 1f, 2 => 1.25f, 3 => 1.5f, 4 => 1.75f, 5 => 2.1f, 6 => 2.5f, 7 => 3f, 8 => 3.6f, 10 => 4.5f, _ => 1f, }; } public static float GetBiologicalTierReduction(int tier) { EnsureCoreEngineBindings(); if (s_coreReductionMethod != null && s_creatureTierEnumType != null) { try { object obj = Enum.ToObject(s_creatureTierEnumType, tier); return (float)s_coreReductionMethod.Invoke(null, new object[1] { obj }); } catch { } } return tier switch { 1 => 0f, 2 => 0.1f, 3 => 0.18f, 4 => 0.25f, 5 => 0.32f, 6 => 0.38f, 7 => 0.44f, 8 => 0.5f, 10 => 0.6f, _ => 0f, }; } public static float GetBiologicalTierSpeedMultiplier(int tier) { EnsureCoreEngineBindings(); if (s_coreSpeedMultMethod != null && s_creatureTierEnumType != null) { try { object obj = Enum.ToObject(s_creatureTierEnumType, tier); return (float)s_coreSpeedMultMethod.Invoke(null, new object[1] { obj }); } catch { } } return tier switch { 1 => 1f, 2 => 1.1f, 3 => 1.18f, 4 => 1.25f, 5 => 1.32f, 6 => 1.38f, 7 => 1.45f, 8 => 1.5f, 10 => 1.4f, _ => 1f, }; } } public static class CataclysmicHudFormatter { private static bool s_installed = false; private static readonly string s_heartGlyph = "<color=#FF4444>❤</color>"; private static readonly string s_lightningGlyph = "<color=#FFD700>⚡</color>"; private static readonly string s_starGlyph = "<color=#FFD700>★</color>"; private static readonly string s_snowflakeGlyph = "<color=#70E0FF>❄</color>"; private static readonly string s_linkGlyph = "<color=#C8A2C8>\ud83d\udd17</color>"; private static FieldInfo s_enemyHudsField; private static FieldInfo s_hudDataGuiField; private static Func<bool> s_isCommandWheelOpen; private static Action<Character> s_invalidateTier; private static Func<Character, float> s_getHealthMult; private static Func<Character, float> s_getDamageMult; private static Func<Character, float> s_getReductionMult; private static Func<Character, float> s_getSpeedMult; private static Action<Character> s_applyUndeadVisuals; private static MethodInfo s_ensureAuraMethod; private static MethodInfo s_refreshAuraMethod; private static Func<int> s_getCurrentSeason; private static Func<bool> s_getMmoInstalled; private static Func<int> s_getMmoPlayerLevel; private static Func<float> s_getMmoDmgBonus; private static Func<Character, bool> s_externalMountSupports; private static FieldInfo s_lastHoveredIdField; private static FieldInfo s_nextHoverComputeTimeField; private static FieldInfo s_lastUntamedHoveredIdField; private static FieldInfo s_nextUntamedHoverComputeTimeField; private static FieldInfo s_cachedHoverNameIdField; private static FieldInfo s_hoverNameCacheExpiryField; private static FieldInfo s_playerHoveringField; private static readonly int s_hpInitKey = StringExtensionMethods.GetStableHashCode("tm_tier_hp_init"); private static readonly int s_specialProfileKey = StringExtensionMethods.GetStableHashCode("TM_070_SpecialProfile"); private static readonly int s_eqChestKey = StringExtensionMethods.GetStableHashCode("tm_eq_chest"); private static readonly int s_statHealthKey = StringExtensionMethods.GetStableHashCode("tm_stat_health"); private static readonly int s_levelKey = StringExtensionMethods.GetStableHashCode("tm_level"); private static readonly int s_xpKey = StringExtensionMethods.GetStableHashCode("tm_xp"); private static readonly int s_pointsKey = StringExtensionMethods.GetStableHashCode("tm_points"); private static readonly int s_orderKey = StringExtensionMethods.GetStableHashCode("tm_order"); private static readonly int s_stanceKey = StringExtensionMethods.GetStableHashCode("tm_stance"); private static readonly int s_groupKey = StringExtensionMethods.GetStableHashCode("tm_group"); private static readonly int s_recoverUntilKey = StringExtensionMethods.GetStableHashCode("tm_recover_until"); private static readonly int s_necroFuryKey = StringExtensionMethods.GetStableHashCode("tm_buff_necro_fury"); private static readonly int s_spectralVeilKey = StringExtensionMethods.GetStableHashCode("tm_buff_spectral_veil"); private static readonly Dictionary<int, int> s_liveStateSignatures = new Dictionary<int, int>(); private static readonly Dictionary<int, int> s_lastKnownCharacterLevels = new Dictionary<int, int>(); private static bool s_isRefreshing = false; private static int s_lastObservedHoverId = 0; private static int s_lastObservedHoverCreatureId = 0; private static int s_cachedTargetCharacterId = 0; private static int s_cachedTargetZdoSig = 0; private static int s_cachedTargetHp = -1; private static int s_cachedTargetMaxHp = -1; private static int s_cachedTargetStamina = -1; private static bool s_cachedTargetAttached = false; private static float s_cachedTargetNextRefresh = 0f; private static string s_cachedTargetHoverText = null; public static void Install(Harmony harmony, Assembly coreAssembly) { //IL_0864: Unknown result type (might be due to invalid IL or missing references) //IL_0871: Expected O, but got Unknown //IL_079e: Unknown result type (might be due to invalid IL or missing references) //IL_07ab: Expected O, but got Unknown //IL_08cc: Unknown result type (might be due to invalid IL or missing references) //IL_08da: Expected O, but got Unknown //IL_07fb: Unknown result type (might be due to invalid IL or missing references) //IL_0808: Expected O, but got Unknown //IL_091a: Unknown result type (might be due to invalid IL or missing references) //IL_0927: Expected O, but got Unknown //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Expected O, but got Unknown //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Expected O, but got Unknown //IL_097f: Unknown result type (might be due to invalid IL or missing references) //IL_098c: Expected O, but got Unknown //IL_09e4: Unknown result type (might be due to invalid IL or missing references) //IL_09f1: Expected O, but got Unknown //IL_0a80: Unknown result type (might be due to invalid IL or missing references) //IL_0a8d: Expected O, but got Unknown //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Expected O, but got Unknown //IL_0aef: Unknown result type (might be due to invalid IL or missing references) //IL_0afc: Expected O, but got Unknown //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Expected O, but got Unknown //IL_0b4b: Unknown result type (might be due to invalid IL or missing references) //IL_0b58: Expected O, but got Unknown //IL_0bc8: Unknown result type (might be due to invalid IL or missing references) //IL_0bd5: Expected O, but got Unknown //IL_0c2e: Unknown result type (might be due to invalid IL or missing references) //IL_0c3b: Expected O, but got Unknown if (s_installed) { return; } s_installed = true; try { if (coreAssembly != null) { Type type = coreAssembly.GetType("TameMate.SupremeTierEngine"); if (type != null) { MethodInfo methodInfo = AccessTools.Method(type, "InvalidateTier", new Type[1] { typeof(Character) }, (Type[])null); if (methodInfo != null) { s_invalidateTier = (Action<Character>)Delegate.CreateDelegate(typeof(Action<Character>), methodInfo); } MethodInfo methodInfo2 = AccessTools.Method(type, "GetTierHealthMultiplier", new Type[1] { typeof(Character) }, (Type[])null); if (methodInfo2 != null) { s_getHealthMult = (Func<Character, float>)Delegate.CreateDelegate(typeof(Func<Character, float>), methodInfo2); } MethodInfo methodInfo3 = AccessTools.Method(type, "GetTierDamageMultiplier", new Type[1] { typeof(Character) }, (Type[])null); if (methodInfo3 != null) { s_getDamageMult = (Func<Character, float>)Delegate.CreateDelegate(typeof(Func<Character, float>), methodInfo3); } MethodInfo methodInfo4 = AccessTools.Method(type, "GetTierDamageReduction", new Type[1] { typeof(Character) }, (Type[])null); if (methodInfo4 != null) { s_getReductionMult = (Func<Character, float>)Delegate.CreateDelegate(typeof(Func<Character, float>), methodInfo4); } MethodInfo methodInfo5 = AccessTools.Method(type, "GetTierSpeedMultiplier", new Type[1] { typeof(Character) }, (Type[])null); if (methodInfo5 != null) { s_getSpeedMult = (Func<Character, float>)Delegate.CreateDelegate(typeof(Func<Character, float>), methodInfo5); } MethodInfo methodInfo6 = AccessTools.Method(type, "GetTierBadge", new Type[1] { typeof(Character) }, (Type[])null); MethodInfo methodInfo7 = AccessTools.Method(typeof(CataclysmicHudFormatter), "GetTierBadge_Postfix", (Type[])null, (Type[])null); if (methodInfo6 != null && methodInfo7 != null) { harmony.Patch((MethodBase)methodInfo6, (HarmonyMethod)null, new HarmonyMethod(methodInfo7, 200, (string[])null, (string[])null, (bool?)null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo8 = AccessTools.Method(type, "GetTierAttributesSummary", new Type[1] { typeof(Character) }, (Type[])null); MethodInfo methodInfo9 = AccessTools.Method(typeof(CataclysmicHudFormatter), "GetTierAttributesSummary_Postfix", (Type[])null, (Type[])null); if (methodInfo8 != null && methodInfo9 != null) { harmony.Patch((MethodBase)methodInfo8, (HarmonyMethod)null, new HarmonyMethod(methodInfo9, 200, (string[])null, (string[])null, (bool?)null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } Type type2 = coreAssembly.GetType("TameMate.UndeadSystem"); if (type2 != null) { MethodInfo methodInfo10 = AccessTools.Method(type2, "ApplyUndeadVisuals", new Type[1] { typeof(Character) }, (Type[])null); if (methodInfo10 != null) { s_applyUndeadVisuals = (Action<Character>)Delegate.CreateDelegate(typeof(Action<Character>), methodInfo10); } MethodInfo methodInfo11 = AccessTools.Method(type2, "SetUndead", new Type[2] { typeof(Character), typeof(bool) }, (Type[])null); MethodInfo methodInfo12 = AccessTools.Method(typeof(CataclysmicHudFormatter), "OnCompanionStateChanged_Postfix", (Type[])null, (Type[])null); if (methodInfo11 != null && methodInfo12 != null) { harmony.Patch((MethodBase)methodInfo11, (HarmonyMethod)null, new HarmonyMethod(methodInfo12), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } Type type3 = coreAssembly.GetType("TameMate.CompanionState"); if (type3 != null) { MethodInfo methodInfo13 = AccessTools.Method(type3, "SetTierOverride", new Type[2] { typeof(Character), typeof(int) }, (Type[])null); MethodInfo methodInfo14 = AccessTools.Method(typeof(CataclysmicHudFormatter), "OnCompanionStateChanged_Postfix", (Type[])null, (Type[])null); if (methodInfo13 != null && methodInfo14 != null) { harmony.Patch((MethodBase)methodInfo13, (HarmonyMethod)null, new HarmonyMethod(methodInfo14), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } Type type4 = coreAssembly.GetType("TameMate.TierVisualAura"); if (type4 != null) { s_ensureAuraMethod = AccessTools.Method(type4, "Ensure", new Type[1] { typeof(Character) }, (Type[])null); s_refreshAuraMethod = AccessTools.Method(type4, "RefreshVisuals", Type.EmptyTypes, (Type[])null); } Type type5 = coreAssembly.GetType("TameMate.TameHoverPatch"); if (type5 != null) { s_lastHoveredIdField = AccessTools.Field(type5, "s_lastHoveredId"); s_nextHoverComputeTimeField = AccessTools.Field(type5, "s_nextHoverComputeTime"); s_lastUntamedHoveredIdField = AccessTools.Field(type5, "s_lastUntamedHoveredId"); s_nextUntamedHoverComputeTimeField = AccessTools.Field(type5, "s_nextUntamedHoverComputeTime"); } Type type6 = coreAssembly.GetType("TameMate.ProgressionPatches"); if (type6 != null) { s_cachedHoverNameIdField = AccessTools.Field(type6, "s_cachedHoverNameId"); s_hoverNameCacheExpiryField = AccessTools.Field(type6, "s_hoverNameCacheExpiry"); } Type type7 = coreAssembly.GetType("TameMate.SeasonBridge"); if (type7 != null) { PropertyInfo property = type7.GetProperty("CurrentSeason", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null) { MethodInfo getMethod = property.GetGetMethod(nonPublic: true); if (getMethod != null) { s_getCurrentSeason = () => (int)getMethod.Invoke(null, null); } } } Type type8 = coreAssembly.GetType("TameMate.EpicMMOBridge"); if (type8 != null) { PropertyInfo property2 = type8.GetProperty("IsInstalled", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property2 != null) { MethodInfo getM = property2.GetGetMethod(nonPublic: true); if (getM != null) { s_getMmoInstalled = () => (bool)getM.Invoke(null, null); } } PropertyInfo property3 = type8.GetProperty("PlayerLevel", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property3 != null) { MethodInfo getM2 = property3.GetGetMethod(nonPublic: true); if (getM2 != null) { s_getMmoPlayerLevel = () => (int)getM2.Invoke(null, null); } } PropertyInfo property4 = type8.GetProperty("CompanionPhysicalDamageBonus", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property4 != null) { MethodInfo getM3 = property4.GetGetMethod(nonPublic: true); if (getM3 != null) { s_getMmoDmgBonus = () => (float)getM3.Invoke(null, null); } } } Type type9 = coreAssembly.GetType("TameMate.ExternalMountBridge"); if (type9 != null) { MethodInfo methodInfo15 = AccessTools.Method(type9, "Supports", new Type[1] { typeof(Character) }, (Type[])null); if (methodInfo15 != null) { s_externalMountSupports = (Func<Character, bool>)Delegate.CreateDelegate(typeof(Func<Character, bool>), methodInfo15); } } Type type10 = coreAssembly.GetType("TameMate.CommandWheel"); if (type10 != null) { PropertyInfo property5 = type10.GetProperty("IsOpen", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property5 != null) { MethodInfo gm = property5.GetGetMethod(nonPublic: true); if (gm != null) { s_isCommandWheelOpen = () => (bool)gm.Invoke(null, null); } } } } Type type11 = AccessTools.TypeByName("TameMate.OceanHorn.SpecialTiers"); if (type11 != null) { MethodInfo methodInfo16 = AccessTools.Method(type11, "NormalizeHealth", new Type[1] { typeof(Character) }, (Type[])null); MethodInfo methodInfo17 = AccessTools.Method(typeof(CataclysmicHudFormatter), "OnCompanionStateChanged_Postfix", (Type[])null, (Type[])null); if (methodInfo16 != null && methodInfo17 != null) { harmony.Patch((MethodBase)methodInfo16, (HarmonyMethod)null, new HarmonyMethod(methodInfo17), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo18 = AccessTools.Method(type11, "AfterTame", new Type[2] { typeof(Character), typeof(bool) }, (Type[])null); if (methodInfo18 != null && methodInfo17 != null) { harmony.Patch((MethodBase)methodInfo18, (HarmonyMethod)null, new HarmonyMethod(methodInfo17), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } MethodInfo methodInfo19 = AccessTools.Method(typeof(Character), "GetHoverName", (Type[])null, (Type[])null); MethodInfo methodInfo20 = AccessTools.Method(typeof(CataclysmicHudFormatter), "GetHoverNamePostfix", (Type[])null, (Type[])null); if (methodInfo19 != null && methodInfo20 != null) { harmony.Patch((MethodBase)methodInfo19, (HarmonyMethod)null, new HarmonyMethod(methodInfo20, 200, (string[])null, (string[])null, (bool?)null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo21 = AccessTools.Method(typeof(Tameable), "GetHoverText", (Type[])null, (Type[])null); MethodInfo methodInfo22 = AccessTools.Method(typeof(CataclysmicHudFormatter), "Tameable_GetHoverText_Prefix", (Type[])null, (Type[])null); if (methodInfo21 != null && methodInfo22 != null) { harmony.Patch((MethodBase)methodInfo21, new HarmonyMethod(methodInfo22, 600, (string[])null, (string[])null, (bool?)null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo23 = AccessTools.Method(typeof(CataclysmicHudFormatter), "Tameable_GetHoverText_Postfix", (Type[])null, (Type[])null); if (methodInfo21 != null && methodInfo23 != null) { harmony.Patch((MethodBase)methodInfo21, (HarmonyMethod)null, new HarmonyMethod(methodInfo23, 0, (string[])null, (string[])null, (bool?)null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo24 = AccessTools.Method(typeof(Player), "UpdateHover", (Type[])null, (Type[])null); MethodInfo methodInfo25 = AccessTools.Method(typeof(CataclysmicHudFormatter), "Player_UpdateHover_Postfix", (Type[])null, (Type[])null); if (methodInfo24 != null && methodInfo25 != null) { harmony.Patch((MethodBase)methodInfo24, (HarmonyMethod)null, new HarmonyMethod(methodInfo25, 0, (string[])null, (string[])null, (bool?)null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo26 = AccessTools.Method(typeof(Sadle), "GetHoverText", (Type[])null, (Type[])null); MethodInfo methodInfo27 = AccessTools.Method(typeof(CataclysmicHudFormatter), "Sadle_GetHoverText_Postfix", (Type[])null, (Type[])null); if (methodInfo26 != null && methodInfo27 != null) { harmony.Patch((MethodBase)methodInfo26, (HarmonyMethod)null, new HarmonyMethod(methodInfo27, 0, (string[])null, (string[])null, (bool?)null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } Type typeFromHandle = typeof(EnemyHud); MethodInfo methodInfo28 = AccessTools.Method(typeFromHandle, "UpdateHuds", new Type[3] { typeof(Player), typeof(Sadle), typeof(float) }, (Type[])null); MethodInfo methodInfo29 = AccessTools.Method(typeof(CataclysmicHudFormatter), "EnemyHud_UpdateHuds_Postfix", (Type[])null, (Type[])null); if (methodInfo28 != null && methodInfo29 != null) { harmony.Patch((MethodBase)methodInfo28, (HarmonyMethod)null, new HarmonyMethod(methodInfo29, 0, (string[])null, (string[])null, (bool?)null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo30 = AccessTools.Method(typeof(Character), "SetLevel", new Type[1] { typeof(int) }, (Type[])null); MethodInfo methodInfo31 = AccessTools.Method(typeof(CataclysmicHudFormatter), "Character_SetLevel_Postfix", (Type[])null, (Type[])null); if (methodInfo30 != null && methodInfo31 != null) { harmony.Patch((MethodBase)methodInfo30, (HarmonyMethod)null, new HarmonyMethod(methodInfo31), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo32 = AccessTools.Method(typeof(Character), "SetupMaxHealth", Type.EmptyTypes, (Type[])null); MethodInfo methodInfo33 = AccessTools.Method(typeof(CataclysmicHudFormatter), "Character_SetupMaxHealth_Postfix", (Type[])null, (Type[])null); if (methodInfo32 != null && methodInfo33 != null) { harmony.Patch((MethodBase)methodInfo32, (HarmonyMethod)null, new HarmonyMethod(methodInfo33), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } Type type12 = AccessTools.TypeByName("StarLevelSystem.modules.UI.UIHudControl"); if (type12 != null) { MethodInfo methodInfo34 = AccessTools.Method(type12, "InvalidateCacheEntry", new Type[1] { typeof(Character) }, (Type[])null); MethodInfo methodInfo35 = AccessTools.Method(typeof(CataclysmicHudFormatter), "Sls_InvalidateCacheEntry_Postfix", (Type[])null, (Type[])null); if (methodInfo34 != null && methodInfo35 != null) { harmony.Patch((MethodBase)methodInfo34, (HarmonyMethod)null, new HarmonyMethod(methodInfo35), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } Type type13 = AccessTools.TypeByName("StarLevelSystem.modules.Cre
TameMate.OceanHorn.dll
Decompiled 3 days 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.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.7.45.0")] namespace TameMate.OceanHorn; public sealed class AdviceFeature : MonoBehaviour { private sealed class Advice { public string Key; public string Topic; public string Text; public string Label; public bool Added; } private static AdviceFeature instance; private readonly List<Advice> pending = new List<Advice>(); private static readonly FieldInfo RavenInstance = AccessTools.Field(typeof(Raven), "m_instance"); private static readonly FieldInfo TempTexts = AccessTools.Field(typeof(Raven), "m_tempTexts"); private static readonly FieldInfo CurrentText = AccessTools.Field(typeof(Raven), "m_currentText"); private static readonly MethodInfo CheckSpawn = AccessTools.Method(typeof(Raven), "CheckSpawn", (Type[])null, (Type[])null); private static readonly FieldInfo DialogTime = AccessTools.Field(typeof(Raven), "m_longDialogVisibleTime"); private static readonly ManualLogSource Log = Logger.CreateLogSource("TameMate Advice"); public static void Queue(string key, string topic, string text, string label) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (string.IsNullOrEmpty(key)) { return; } if ((Object)(object)instance == (Object)null) { GameObject val = new GameObject("TameMate Advice Queue"); Object.DontDestroyOnLoad((Object)(object)val); instance = val.AddComponent<AdviceFeature>(); } string text2 = AdvicePolicy.Key(key); Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null && localPlayer.HaveSeenTutorial(text2)) { return; } foreach (Advice item in instance.pending) { if (item.Key == text2) { return; } } if (instance.pending.Count >= 16) { Log.LogWarning((object)("Advice queue full; tip not accepted: " + key)); return; } instance.pending.Add(new Advice { Key = text2, Topic = AdvicePolicy.Topic(topic), Text = AdvicePresentation0737.Clean(AdvicePolicy.Text(key, text)), Label = label }); if (!((MonoBehaviour)instance).IsInvoking("Deliver")) { ((MonoBehaviour)instance).InvokeRepeating("Deliver", 3f, 3f); } } private void Deliver() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead()) { return; } if (pending.Count == 0) { ((MonoBehaviour)this).CancelInvoke("Deliver"); return; } try { Advice advice = pending[0]; if (localPlayer.HaveSeenTutorial(advice.Key)) { pending.RemoveAt(0); return; } if (!advice.Added) { Raven.AddTempText(advice.Key, advice.Topic, advice.Text, advice.Label, false); IEnumerable enumerable = ((TempTexts == null) ? null : (TempTexts.GetValue(null) as IEnumerable)); if (enumerable == null) { return; } object obj = null; foreach (object item in enumerable) { Traverse val = Traverse.Create(item); if (val.Field("m_key").GetValue<string>() != advice.Key) { continue; } val.Field("m_alwaysSpawn").SetValue((object)true); val.Field("m_priority").SetValue((object)150); obj = item; advice.Added = true; break; } IList list = enumerable as IList; if (obj != null && list != null && list.IndexOf(obj) > 0) { list.Remove(obj); list.Insert(0, obj); } if (advice.Added) { Log.LogInfo((object)("Advice queued for reading: " + advice.Key)); } } Raven val2 = (Raven)((RavenInstance == null) ? null : /*isinst with value type is only supported in some contexts*/); if ((Object)(object)val2 != (Object)null && advice.Added && CheckSpawn != null) { CheckSpawn.Invoke(val2, null); } } catch (Exception ex) { ((MonoBehaviour)this).CancelInvoke("Deliver"); Log.LogWarning((object)("Advice delivery stopped: " + ex.Message)); } } internal static bool IsOurCurrentAdvice(Raven raven) { object obj = ((CurrentText == null) ? null : CurrentText.GetValue(raven)); return ((obj == null) ? null : Traverse.Create(obj).Field("m_key").GetValue<string>())?.StartsWith("tamemate", StringComparison.OrdinalIgnoreCase) ?? false; } internal static float BeginLongDialog(Raven raven) { if (DialogTime == null) { return -1f; } float num = (float)DialogTime.GetValue(raven); DialogTime.SetValue(raven, Math.Max(num, 45f)); return num; } internal static void EndLongDialog(Raven raven, float old) { if (old >= 0f && DialogTime != null) { DialogTime.SetValue(raven, old); } } public static float WelcomeDuration(float original, string text) { return (text != null && text.Contains(ModLanguage.Text("Bienvenido a TameMate "))) ? 12f : original; } } [HarmonyPatch(typeof(Raven), "Say")] internal static class AdviceReadingTime { private static void Prefix(Raven __instance, ref bool longTimeout, out float __state) { __state = -1f; if (AdviceFeature.IsOurCurrentAdvice(__instance)) { longTimeout = true; __state = AdviceFeature.BeginLongDialog(__instance); } } private static void Postfix(Raven __instance, float __state) { AdviceFeature.EndLongDialog(__instance, __state); } } [HarmonyPatch(typeof(MessageHud), "ShowMessage")] internal static class WelcomeReadingTime { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { foreach (CodeInstruction instruction in instructions) { yield return instruction; if (instruction.opcode == OpCodes.Ldc_R4 && instruction.operand is float && (float)instruction.operand == 4f) { yield return new CodeInstruction(OpCodes.Ldarg_2, (object)null); yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(AdviceFeature), "WelcomeDuration", (Type[])null, (Type[])null)); } } } } public static class AdvicePolicy { public const string AdviceIntroduction = ""; public static string Key(string key) { return key + "_070"; } public static string Topic(string topic) { return (topic ?? "TameMate").Replace("TameMate 0.6.2", "TameMate 0.7.45").Replace("TameMate 0.6.8", "TameMate 0.7.45"); } public static string Text(string key, string text) { text = text ?? ""; if (key == "tamemate_duel_tame") { text = ModLanguage.Text("La doma de combate requiere nivel, atributos y, cuando corresponda, el trofeo de la especie. Debilita a la criatura hasta el umbral de tu dificultad. Al mínimo efectivo tienes 30% de éxito; Cataclysm o No-muerto, 20%; ambos combinados, 10%. Cada nivel adicional añade 5 puntos hasta 100%. Si rechaza la doma, gana furia limitada y debes esperar 30 segundos. No-muerto conserva su tier y Cataclysm conserva su elemento al terminar el evento. Las variantes especiales requieren combate y reducen su potencia salvaje al domesticar. La fauna ordinaria compatible conserva la alimentación pacífica."); } if (key == "tamemate_dungeon_rescue") { text = ModLanguage.Text("Los seguidores pueden acompañarte al cruzar entradas compatibles. Para rescatar compañeros rezagados usa U → Reunir. Esa orden mantiene el seguimiento hasta dar otra. Los sonidos de doma o equipo no reúnen ni transportan a las demás criaturas."); } if (key == "tamemate_boss_trinity") { text = ModLanguage.Text("Los jefes desbloquean pasivas y ascienden su bioma. Las recetas de progresión usan ingredientes de Valheim y Monstrum, sin trofeos de BiomeLords. Los jefes de BiomeLords no admiten nuevas domas. El pico de cornamenta conserva su receta y uso normales. Para consagrar cualquier jefe, usa su trofeo desde inventario o barra rápida; también se admite Mayús + E sobre su trofeo colgado. Costes de rangos 1/2/3: 1/1/2 trofeos."); } if (text.IndexOf("F11", StringComparison.OrdinalIgnoreCase) < 0) { text += ModLanguage.Text("\n\n<b>Guía TameMate:</b> pulsa F11 para consultar controles, requisitos, dificultad y pasivas."); } return text.StartsWith(ModLanguage.Text("Por si eres como la Jen toda olvidadisa aqui estoy yo para ensarte!"), StringComparison.Ordinal) ? text : (ModLanguage.Text("Por si eres como la Jen toda olvidadisa aqui estoy yo para ensarte!\n\n") + text); } } public static class AttributeSkinCompatibility { private const BindingFlags Flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private static Type visualType; private static MethodInfo eligible; private static Func<object, Character, bool> original; private static Func<object, string> allowed; private static Func<object, string> excluded; private static Func<string, string, string, bool> prefabAllowed; private static Func<object, bool> owns; private static Func<object, string> ConfigGetter(Type type, string name) { ParameterExpression parameterExpression = Expression.Parameter(typeof(object)); MemberExpression expression = Expression.Field(Expression.Convert(parameterExpression, type), type.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)); return Expression.Lambda<Func<object, string>>(Expression.Property(expression, "Value"), new ParameterExpression[1] { parameterExpression }).Compile(); } public static void Install() { //IL_01ca: 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_01fe: Expected O, but got Unknown if (!Chainloader.PluginInfos.TryGetValue("TheLionCid.SeasonalSLSBridge", out var value)) { return; } try { Assembly assembly = ((object)value.Instance).GetType().Assembly; Type type = assembly.GetType("SeasonalSLSBridge.Plugin", throwOnError: true); visualType = assembly.GetType("SeasonalSLSBridge.CreatureVisual", throwOnError: true); eligible = type.GetMethod("Eligible", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(Character) }, null); ParameterExpression parameterExpression = Expression.Parameter(typeof(object)); ParameterExpression parameterExpression2 = Expression.Parameter(typeof(Character)); original = Expression.Lambda<Func<object, Character, bool>>(Expression.Call(Expression.Convert(parameterExpression, type), eligible, parameterExpression2), new ParameterExpression[2] { parameterExpression, parameterExpression2 }).Compile(); allowed = ConfigGetter(type, "AllowedPrefabs"); excluded = ConfigGetter(type, "ExcludedPrefabs"); prefabAllowed = (Func<string, string, string, bool>)Delegate.CreateDelegate(typeof(Func<string, string, string, bool>), assembly.GetType("SeasonalSLSBridge.SeasonalPolicy", throwOnError: true).GetMethod("PrefabAllowed", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)); UnaryExpression expression = Expression.Convert(parameterExpression, visualType); UnaryExpression expression2 = Expression.Convert(Expression.Field(expression, visualType.GetField("_materials", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)), typeof(ICollection)); owns = Expression.Lambda<Func<object, bool>>(Expression.AndAlso(Expression.Not(Expression.Field(expression, visualType.GetField("_stopped", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))), Expression.GreaterThan(Expression.Property(expression2, "Count"), Expression.Constant(0))), new ParameterExpression[1] { parameterExpression }).Compile(); new Harmony("mitsu.tamemate.attribute-skins").Patch((MethodBase)visualType.GetMethod("Update", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(AttributeSkinCompatibility), "Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null); Logger.CreateLogSource("TameMate Attribute Skins").LogInfo((object)"Bridge visual eligibility extended to companions; seasonal gameplay eligibility unchanged."); } catch (Exception ex) { owns = null; Logger.CreateLogSource("TameMate Attribute Skins").LogWarning((object)("Optional skin integration unavailable: " + ex.GetBaseException().Message)); } } public static bool VisualEligible(object plugin, Character creature) { if ((Object)(object)creature == (Object)null || !creature.IsTamed()) { return original(plugin, creature); } if (creature.IsDead() || creature.IsPlayer() || creature.IsBoss() || (Object)(object)((Component)creature).GetComponent<Trader>() != (Object)null) { return false; } return prefabAllowed(Utils.GetPrefabName(((Component)creature).gameObject), allowed(plugin), excluded(plugin)); } public static bool OwnsSkin(Character creature) { if (owns == null || (Object)(object)creature == (Object)null) { return false; } Component component = ((Component)creature).GetComponent(visualType); return (Object)(object)component != (Object)null && owns(component); } private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); int num = 0; foreach (CodeInstruction item in list) { if ((item.opcode == OpCodes.Call || item.opcode == OpCodes.Callvirt) && object.Equals(item.operand, eligible)) { item.opcode = OpCodes.Call; item.operand = typeof(AttributeSkinCompatibility).GetMethod("VisualEligible"); num++; } } if (num != 1) { throw new InvalidOperationException("Bridge visual eligibility boundary changed."); } return list; } } public static class BiomeProgression { private static readonly ManualLogSource Log = Logger.CreateLogSource("TameMate Progression"); private static readonly Dictionary<string, string> PrefabKeys = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "NeckLord", "NeckLord" }, { "GreydwarfShamanLord", "GreydwarfLord" }, { "DraugrEliteLord", "DraugrLord" }, { "FenringLord", "FenringLord" }, { "LoxLord", "LoxLord" }, { "SeekerLord", "SeekerLord" }, { "FallerValkyrieLord", "ValkyrieLord" }, { "GammeltrollLord", "DeepNorth" } }; private static readonly Dictionary<string, string> GlobalKeys = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "NeckLord", "defeated_neck_lord" }, { "GreydwarfLord", "defeated_greydwarf_lord" }, { "DraugrLord", "defeated_draugr_lord" }, { "FenringLord", "defeated_fenring_lord" }, { "LoxLord", "defeated_lox_lord" }, { "SeekerLord", "defeated_seeker_lord" }, { "ValkyrieLord", "defeated_faller_valkyrie_lord" }, { "DeepNorth", "defeated_gammeltroll_lord" } }; public static bool Defeated(bool nativeResult, string bossKey) { if (nativeResult) { return true; } string value; return (Object)(object)ZoneSystem.instance != (Object)null && bossKey != null && GlobalKeys.TryGetValue(bossKey, out value) && (ZoneSystem.instance.GetGlobalKey(value) || ZoneSystem.instance.GetGlobalKey("biomelords_" + value)); } public static string AppendGuide(string text) { return BalanceGuide0738.Biomes(text); } public static void RecordDeath(Character creature) { if ((Object)(object)creature == (Object)null || creature.IsPlayer() || creature.IsTamed() || !creature.IsDead() || (Object)(object)ZoneSystem.instance == (Object)null || (Object)(object)ZNet.instance == (Object)null) { return; } ZNetView component = ((Component)creature).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid() || !component.IsOwner()) { return; } if (creature.IsBoss()) { SpecialTiers.EventChangedForBoss(); } if (!PrefabKeys.TryGetValue(Utils.GetPrefabName(((Component)creature).gameObject), out var value)) { return; } string text = GlobalKeys[value]; if (!Defeated(nativeResult: false, value)) { ZoneSystem.instance.SetGlobalKey(text); SpecialTiers.EventChangedForBoss(); Log.LogInfo((object)("World biome ascension submitted through native global-key route: " + value + " -> " + text + ". Repeated kills do not add stages.")); if (ZNet.instance.IsServer() && (Object)(object)Player.m_localPlayer != (Object)null) { AdviceFeature.Queue("tamemate_lord_ascension_" + ZNet.instance.GetWorldUID() + "_" + value, ModLanguage.Text("El bioma se fortalece"), ModLanguage.Text("La primera derrota mundial de ") + value + ModLanguage.Text(" añade un nivel de ascensión a su bioma. Se suma a los otros jefes de esa región, aunque BiomeLords use progreso personal. Repetir el mismo jefe no añade otro nivel. El preset determina el daño adicional; los tiers y las nuevas apariciones reflejan la progresión. Consulta F11."), "tamemate_guide"); } } } } [HarmonyPatch(typeof(ZoneSystem), "RPC_GlobalKeys")] internal static class BiomeProgressionSync { [HarmonyPostfix] private static void Postfix() { SpecialTiers.EventChangedForBoss(); } } [HarmonyPatch(typeof(SpawnSystem), "UpdateSpawnList")] internal static class BloodMoonSpawns { internal struct Snapshot { public SpawnData Data; public float Chance; public float Interval; public int Maximum; public int GroupMaximum; } private static Func<bool> active; private static ConfigEntry<float> multiplier; private static int spawned; private static float nextReport; internal static bool Active => active != null && active(); public static void Configure(Assembly core) { Type type = core.GetType("TameMate.BloodMoonManager"); active = (Func<bool>)Delegate.CreateDelegate(typeof(Func<bool>), AccessTools.PropertyGetter(type, "IsActive")); multiplier = (ConfigEntry<float>)AccessTools.Field(core.GetType("TameMate.TameMateConfig"), "BloodMoonSpawnMultiplier").GetValue(null); } [HarmonyPrefix] [HarmonyPriority(0)] private static void Prefix(List<SpawnData> spawners, bool eventSpawners, out List<Snapshot> __state) { __state = null; if (!Active) { spawned = 0; nextReport = 0f; } else { if (eventSpawners || spawners == null) { return; } float num = Mathf.Clamp((multiplier == null) ? 2f : multiplier.Value, 1f, 3f); if (num <= 1f) { return; } foreach (SpawnData spawner in spawners) { if (spawner == null || !spawner.m_enabled || !spawner.m_spawnAtNight || (Object)(object)spawner.m_prefab == (Object)null) { continue; } Character component = spawner.m_prefab.GetComponent<Character>(); if (!((Object)(object)component == (Object)null) && !component.IsBoss() && 0 == 0) { if (__state == null) { __state = new List<Snapshot>(); } __state.Add(new Snapshot { Data = spawner, Chance = spawner.m_spawnChance, Interval = spawner.m_spawnInterval, Maximum = spawner.m_maxSpawned, GroupMaximum = spawner.m_groupSizeMax }); spawner.m_spawnChance = Mathf.Min(100f, spawner.m_spawnChance * num); spawner.m_spawnInterval = RevisionPolicy.SpawnInterval(spawner.m_spawnInterval, num); spawner.m_maxSpawned = RevisionPolicy.SpawnCap(spawner.m_maxSpawned, num); spawner.m_groupSizeMax = Math.Max(spawner.m_groupSizeMax, Math.Min(4, Mathf.CeilToInt((float)spawner.m_groupSizeMax * num))); } } Report(num); } } private static void Restore(List<Snapshot> snapshots) { if (snapshots == null) { return; } foreach (Snapshot snapshot in snapshots) { snapshot.Data.m_spawnChance = snapshot.Chance; snapshot.Data.m_spawnInterval = snapshot.Interval; snapshot.Data.m_maxSpawned = snapshot.Maximum; snapshot.Data.m_groupSizeMax = snapshot.GroupMaximum; } snapshots.Clear(); } [HarmonyPostfix] private static void Postfix(List<Snapshot> __state) { Restore(__state); } [HarmonyFinalizer] private static void Finalizer(List<Snapshot> __state) { Restore(__state); } internal static void RecordSpawn() { if (Active) { spawned++; } } private static void Report(float factor) { if (!(Time.time < nextReport)) { nextReport = Time.time + 30f; if ((Object)(object)Player.m_localPlayer != (Object)null) { ((Character)Player.m_localPlayer).Message((MessageType)1, ModLanguage.Text("Luna de Sangre: intensidad x") + factor.ToString("0.##") + ModLanguage.Text(" | criaturas aparecidas desde el aviso anterior: ") + spawned + ModLanguage.Text(". Se respetan bioma y zonas protegidas."), 0, (Sprite)null, false); } spawned = 0; } } } [HarmonyPatch(typeof(SpawnSystem), "Spawn")] internal static class BloodMoonSpawnCounter { [HarmonyPostfix] private static void Postfix(bool __runOriginal) { if (__runOriginal) { BloodMoonSpawns.RecordSpawn(); } } } public static class CompanionCombatMemory { private const int Attack = 6; private static readonly int OwnerKey = StringExtensionMethods.GetStableHashCode("tm_owner"); private static readonly int OrderKey = StringExtensionMethods.GetStableHashCode("tm_order"); private static readonly int TargetKey = StringExtensionMethods.GetStableHashCode("tm_target"); private static readonly int PatrolLegKey = StringExtensionMethods.GetStableHashCode("tm_patrol_leg"); private static readonly int ReturnOrderKey = StringExtensionMethods.GetStableHashCode("TM_071_CombatReturnOrder"); private static readonly int ReturnPointKey = StringExtensionMethods.GetStableHashCode("TM_071_CombatReturnPoint"); private static readonly int ReturnLegKey = StringExtensionMethods.GetStableHashCode("TM_071_CombatReturnLeg"); private static readonly int EngagedKey = StringExtensionMethods.GetStableHashCode("TM_071_CombatEngaged"); private static readonly int DefenseOrderKey = StringExtensionMethods.GetStableHashCode("TM_071_DefenseReturnOrder"); private static readonly int DefensePointKey = StringExtensionMethods.GetStableHashCode("TM_071_DefenseReturnPoint"); private static readonly int DefenseLegKey = StringExtensionMethods.GetStableHashCode("TM_071_DefenseReturnLeg"); private static readonly Func<Character, ZNetView> NetView = BuildNetViewGetter(); private static Func<Character, ZNetView> BuildNetViewGetter() { ParameterExpression parameterExpression = Expression.Parameter(typeof(Character)); return Expression.Lambda<Func<Character, ZNetView>>(Expression.Field(parameterExpression, AccessTools.Field(typeof(Character), "m_nview")), new ParameterExpression[1] { parameterExpression }).Compile(); } private static ZDO OwnedData(Character creature) { if ((Object)(object)creature == (Object)null || !creature.IsTamed() || creature.IsDead()) { return null; } ZNetView val = NetView(creature); return ((Object)(object)val != (Object)null && val.IsValid() && val.IsOwner()) ? val.GetZDO() : null; } private static void SaveReturn(ZDO data, Character creature, int order) { //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_0043: Unknown result type (might be due to invalid IL or missing references) bool flag = order >= 0 && order < 6; data.Set(ReturnOrderKey, (!flag) ? 1 : (order + 1), false); data.Set(ReturnPointKey, flag ? data.GetVec3(TargetKey, ((Component)creature).transform.position) : ((Component)creature).transform.position); data.Set(ReturnLegKey, data.GetInt(PatrolLegKey, 0), false); data.Set(EngagedKey, 0, false); } public static void BeforeCommand(Tameable tame, int order, long playerId) { if ((Object)(object)tame == (Object)null) { return; } Character component = ((Component)tame).GetComponent<Character>(); ZDO val = OwnedData(component); if (val == null) { return; } long num = val.GetLong(OwnerKey, 0L); if (num != 0 && num != playerId) { return; } if (val.GetInt(DefenseOrderKey, 0) != 0) { val.Set(DefenseOrderKey, 0, false); } order = Mathf.Clamp(order, 0, 6); if (order == 6) { int num2 = val.GetInt(OrderKey, 0); if (num2 != 6 || val.GetInt(ReturnOrderKey, 0) == 0) { SaveReturn(val, component, num2); } else if (val.GetInt(EngagedKey, 0) != 0) { val.Set(EngagedKey, 0, false); } } else if (val.GetInt(ReturnOrderKey, 0) != 0 || val.GetInt(EngagedKey, 0) != 0) { val.Set(ReturnOrderKey, 0, false); val.Set(EngagedKey, 0, false); } } public static void Engaged(Character creature) { ZDO val = OwnedData(creature); if (val != null && val.GetInt(OrderKey, 0) == 6 && val.GetInt(EngagedKey, 0) == 0) { if (val.GetInt(ReturnOrderKey, 0) == 0) { SaveReturn(val, creature, 6); } val.Set(EngagedKey, 1, false); } } public static void BeforeDefense(Character creature) { //IL_007d: 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) ZDO val = OwnedData(creature); if (val != null && val.GetInt(DefenseOrderKey, 0) == 0) { int num = val.GetInt(OrderKey, 0); if (num >= 0 && num < 6) { val.Set(DefenseOrderKey, num + 1, false); val.Set(DefensePointKey, val.GetVec3(TargetKey, ((Component)creature).transform.position)); val.Set(DefenseLegKey, val.GetInt(PatrolLegKey, 0), false); } } } public static bool RestoreAfterDefense(Character creature) { //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_006d: 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) ZDO val = OwnedData(creature); if (val == null) { return false; } int num = val.GetInt(DefenseOrderKey, 0); if (num < 1 || num > 6) { return false; } int num2 = num - 1; Vector3 vec = val.GetVec3(DefensePointKey, ((Component)creature).transform.position); int num3 = val.GetInt(DefenseLegKey, 0); if (val.GetInt(OrderKey, 0) != num2) { val.Set(OrderKey, num2, false); } val.Set(TargetKey, vec); if (val.GetInt(PatrolLegKey, 0) != num3) { val.Set(PatrolLegKey, num3, false); } val.Set(DefenseOrderKey, 0, false); return true; } public static bool RestoreAfterCombat(Character creature) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) ZDO val = OwnedData(creature); if (val == null || val.GetInt(OrderKey, 0) != 6 || val.GetInt(EngagedKey, 0) == 0) { return false; } int num = val.GetInt(ReturnOrderKey, 0); if (num < 1 || num > 6) { return false; } val.Set(OrderKey, num - 1, false); val.Set(TargetKey, val.GetVec3(ReturnPointKey, ((Component)creature).transform.position)); val.Set(PatrolLegKey, val.GetInt(ReturnLegKey, 0), false); val.Set(ReturnOrderKey, 0, false); val.Set(EngagedKey, 0, false); return true; } } public static class CreatureStamina { private static Func<Character, int> tier; private static Func<Character, bool> externalController; private static Func<int, float> health; private static Func<int, float> damage; private static Func<int, float> reduction; private static Func<int, float> speed; private static readonly int LevelKey = StringExtensionMethods.GetStableHashCode("tm_level"); private static readonly int PointsKey = StringExtensionMethods.GetStableHashCode("tm_stat_stamina"); private static readonly Func<Character, ZNetView> NetView = BuildNetView(); private static readonly string[] GuideBase = new string[2]; private static readonly string[] GuideResult = new string[2]; private static Func<Character, ZNetView> BuildNetView() { ParameterExpression parameterExpression = Expression.Parameter(typeof(Character)); return Expression.Lambda<Func<Character, ZNetView>>(Expression.Field(parameterExpression, AccessTools.Field(typeof(Character), "m_nview")), new ParameterExpression[1] { parameterExpression }).Compile(); } public static void Configure(Type corePlugin) { if (tier == null) { Type type = corePlugin.Assembly.GetType("TameMate.SupremeTierEngine", throwOnError: true); ParameterExpression parameterExpression = Expression.Parameter(typeof(Character)); tier = Expression.Lambda<Func<Character, int>>(Expression.Convert(Expression.Call(AccessTools.Method(type, "GetTier", (Type[])null, (Type[])null), parameterExpression), typeof(int)), new ParameterExpression[1] { parameterExpression }).Compile(); health = EnumMultiplier(type, "GetTierHealthMultiplier"); damage = EnumMultiplier(type, "GetTierDamageMultiplier"); reduction = EnumMultiplier(type, "GetTierDamageReduction"); speed = EnumMultiplier(type, "GetTierSpeedMultiplier"); Type type2 = corePlugin.Assembly.GetType("TameMate.ExternalMountBridge"); if (type2 != null) { externalController = (Func<Character, bool>)Delegate.CreateDelegate(typeof(Func<Character, bool>), AccessTools.Method(type2, "Supports", (Type[])null, (Type[])null)); } } } private static Func<int, float> EnumMultiplier(Type engine, string name) { Type type = engine.Assembly.GetType("TameMate.CreatureTier", throwOnError: true); MethodInfo method = AccessTools.Method(engine, name, new Type[1] { type }, (Type[])null); ParameterExpression parameterExpression = Expression.Parameter(typeof(int)); return Expression.Lambda<Func<int, float>>(Expression.Call(method, Expression.Convert(parameterExpression, type)), new ParameterExpression[1] { parameterExpression }).Compile(); } public static float ForSaddle(Sadle saddle, float original) { return ((Object)(object)saddle == (Object)null) ? original : Maximum(saddle.GetCharacter(), original); } private static float Maximum(Character c, float original) { if ((Object)(object)c == (Object)null || c.IsPlayer() || !c.IsTamed()) { return original; } ZNetView val = NetView(c); ZDO val2 = (((Object)(object)val != (Object)null && val.IsValid()) ? val.GetZDO() : null); if (val2 == null) { return original; } int companionLevel = Math.Max(1, val2.GetInt(LevelKey, 1)); int points = val2.GetInt(PointsKey, 0); float bodySize = Math.Max(c.GetHeight(), c.GetRadius() * 2f); float speciesBase = CreatureStaminaPolicy.SpeciesBase(original, bodySize); return CreatureStaminaPolicy.Maximum(speciesBase, (tier == null) ? 1 : tier(c), companionLevel, points); } private static float ActualOrPotential(Character c, out Sadle saddle) { Tameable component = ((Component)c).GetComponent<Tameable>(); saddle = (((Object)(object)component == (Object)null) ? null : component.m_saddle); return ((Object)(object)saddle == (Object)null) ? Maximum(c, 100f) : saddle.GetMaxStamina(); } public static void AppendHover(StringBuilder builder, Character c) { if ((Object)(object)c == (Object)null || !c.IsTamed()) { return; } Sadle saddle; float num = ActualOrPotential(c, out saddle); if ((Object)(object)saddle == (Object)null && c.GetHeight() < 0.85f) { return; } if ((Object)(object)saddle == (Object)null && externalController != null && externalController(c)) { builder.Append(ModLanguage.IsEnglish ? "\nExternal riding controller: does not use this stamina pool." : "\nMonta externa: no usa esta reserva de aguante."); return; } builder.Append(ModLanguage.IsEnglish ? "\nRiding stamina: " : "\nAguante de monta: "); if ((Object)(object)saddle != (Object)null) { builder.Append(Mathf.CeilToInt(saddle.GetStamina())).Append('/'); } builder.Append(Mathf.CeilToInt(num)); if ((Object)(object)saddle == (Object)null) { builder.Append(ModLanguage.IsEnglish ? " (potential)" : " (potencial)"); } } public static string EvolutionDescription(Character c, int newTier, string original) { string text = original; if ((newTier == 2 || newTier == 3) && health != null) { text = string.Format(ModLanguage.IsEnglish ? "Tier bonuses over Feral: health +{0:0}%, damage +{1:0}%, mitigation {2:0}%, speed +{3:0}%, riding stamina +{4:0}%." : "Bonos del tier respecto a Feral: salud +{0:0}%, daño +{1:0}%, mitigación {2:0}%, velocidad +{3:0}%, aguante de monta +{4:0}%.", (health(newTier) - 1f) * 100f, (damage(newTier) - 1f) * 100f, reduction(newTier) * 100f, (speed(newTier) - 1f) * 100f, (CreatureStaminaPolicy.TierMultiplier(newTier) - 1f) * 100f); } Sadle saddle; float num = ActualOrPotential(c, out saddle); QueueAdvice(); if ((Object)(object)saddle == (Object)null && externalController != null && externalController(c)) { return text + (ModLanguage.IsEnglish ? "\nIts external riding controller does not use TameMate's stamina pool." : "\nSu controlador de monta externo no usa la reserva de aguante de TameMate."); } return text + string.Format(ModLanguage.IsEnglish ? "\nMaximum riding stamina: {0:0}." : "\nAguante máximo de monta: {0:0}.", num); } public static string AppendGuide(int chapter, string content) { if (chapter != 4) { return content; } int num = ModLanguage.Index(); if (GuideBase[num] == content && GuideResult[num] != null) { return GuideResult[num]; } string text = (ModLanguage.IsEnglish ? "\n\n<b>Riding stamina and evolution (0.7.3)</b>\nDefault saddles use a body profile: agile 100, standard 140, heavy 180. Explicit non-default saddle values from other mods are retained. Tier multipliers: Feral x1, Alpha x1.2, Apex x1.4, Frostborn x1.6, Primal x1.8, Astral x2, Infernal x2.2, Ancestral x2.4, Cataclysmic x2.6, Supreme x2.8. Undead retains its base tier without another stamina multiplier.\nCompanion levels add 1% per level after level 1, up to +50%; each Stamina point multiplies capacity by another 5% of its level/tier capacity. Stars do not grant an extra stamina multiplier. Running, swimming and attack costs, hunger and native regeneration remain in effect. Evolution raises capacity without refilling spent stamina.\nA level-1 agile boar with no points has 100 as Feral, 120 as Alpha and 140 as Apex. Alpha also grants +35% tier health, +25% tier damage, 10% mitigation and +10% tier speed over Feral. This does not turn a boar into a higher-biome beast. Check the creature's hover for its actual or potential riding stamina. Unmounted NPC AI keeps Valheim's combat rules; this is the riding reserve." : "\n\n<b>Aguante de monta y evolución (0.7.3)</b>\nLas sillas con valor genérico usan el perfil corporal: ágil 100, equilibrado 140, pesado 180. Se respetan valores propios distintos de 100 de las sillas de otros mods. Multiplicadores por tier: Feral x1, Alpha x1.2, Apex x1.4, Frostborn x1.6, Primal x1.8, Astral x2, Infernal x2.2, Ancestral x2.4, Cataclysmic x2.6, Supreme x2.8. No-muerto conserva su tier base sin otro multiplicador de aguante.\nCada nivel de compañero después del 1 añade 1%, hasta +50%; cada punto de Aguante añade otro 5% de la capacidad de su nivel/tier. Las estrellas no multiplican de nuevo el aguante. Se conservan los costes de correr, nadar y atacar, el hambre y la regeneración nativa. Evolucionar aumenta el máximo sin rellenar lo ya gastado.\nUn jabalí ágil de nivel 1 sin puntos tiene 100 como Feral, 120 como Alpha y 140 como Apex. Alpha también aporta +35% de vida, +25% de daño, 10% de mitigación y +10% de velocidad del tier respecto a Feral. No convierte al jabalí en una bestia de otro bioma. Al apuntar ves su aguante de monta real o potencial. La IA sin jinete mantiene las reglas de combate de Valheim; esta es la reserva de monta."); GuideBase[num] = content; return GuideResult[num] = content + text; } internal static void QueueAdvice() { AdviceFeature.Queue("tamemate_stamina_073", ModLanguage.IsEnglish ? "Your companion's stamina" : "El aguante de tu compañero", ModLanguage.IsEnglish ? "Riding stamina now depends on body profile, tier, companion level and Stamina points. Generic bases are 100/140/180; explicit saddle values from other mods remain. A level-1 agile Feral boar has 100, Alpha 120 and Apex 140 before points. Alpha also improves tier health, damage, mitigation and speed. Evolution raises capacity without refilling spent stamina; running, swimming, attacking, hunger and regeneration still apply. Check F11, chapter 4, and creature hover information." : "El aguante de monta depende del perfil corporal, tier, nivel del compañero y puntos de Aguante. Las bases genéricas son 100/140/180; se respetan valores propios de las sillas de otros mods. Un jabalí ágil Feral de nivel 1 tiene 100, Alpha 120 y Apex 140 antes de puntos. Alpha también mejora vida, daño, mitigación y velocidad del tier. Evolucionar aumenta la capacidad sin rellenar lo gastado; correr, nadar, atacar, el hambre y la regeneración siguen contando. Consulta F11, capítulo 4, y la información al apuntar.", "tamemate_guide"); } } [HarmonyPatch(typeof(Sadle), "Interact")] internal static class CreatureStaminaMountAdvice { [HarmonyPostfix] private static void Postfix(bool __result) { if (__result && (Object)(object)Player.m_localPlayer != (Object)null) { CreatureStamina.QueueAdvice(); } } } public static class CreatureStaminaPolicy { public static float SpeciesBase(float nativeBase, float bodySize) { if (!float.IsNaN(nativeBase) && !float.IsInfinity(nativeBase) && nativeBase > 0f && Math.Abs(nativeBase - 100f) > 0.01f) { return nativeBase; } return (bodySize < 1.9f) ? 100f : ((bodySize > 3.2f) ? 180f : 140f); } public static float TierMultiplier(int tier) { return (tier >= 1 && tier <= 10) ? (1f + 0.2f * (float)(tier - 1)) : 1f; } public static float Maximum(float speciesBase, int tier, int companionLevel, int points) { float num = 1f + (float)Math.Min(50, Math.Max(1, companionLevel) - 1) * 0.01f; return speciesBase * TierMultiplier(tier) * num * (1f + (float)Math.Max(0, points) * 0.05f); } } internal static class DungeonTravelCompatibility { [ThreadStatic] internal static bool DungeonInteraction; private static readonly int ActiveKey = StringExtensionMethods.GetStableHashCode("tm_command_active"); private static readonly int OrderKey = StringExtensionMethods.GetStableHashCode("tm_order"); internal static MethodBase Core(string type, string method) { return AccessTools.Method(AccessTools.TypeByName("TameMate." + type), method, (Type[])null, (Type[])null); } internal static bool Staying(Character c) { if ((Object)(object)c == (Object)null || !c.IsTamed()) { return false; } ZNetView component = ((Component)c).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid()) { return false; } ZDO zDO = component.GetZDO(); return zDO != null && zDO.GetInt(ActiveKey, 0) != 0 && zDO.GetInt(OrderKey, 0) == 0; } internal static IEnumerator GuardQueued(IEnumerator original, Player player) { try { while ((Object)(object)player != (Object)null && !DungeonTravelPolicy.BlockTransit(((Component)player).transform.position.y, ((Component)player).transform.position.y, DungeonInteraction) && original.MoveNext()) { yield return original.Current; } } finally { if (original is IDisposable disposable) { disposable.Dispose(); } } } internal static string Advice() { return ModLanguage.IsEnglish ? "Companions no longer teleport automatically into or out of dungeons. Use Stay outside: they keep their saved position until you give another order. Regroup remains an explicit manual rescue. Ordinary surface portal travel keeps its existing behavior. See F11." : "Las domas ya no se teletransportan automáticamente al entrar o salir de mazmorras. Usa Quédate afuera: conservan su punto hasta que des otra orden. Reunir sigue siendo un rescate manual explícito. Los portales normales de superficie conservan su funcionamiento. Consulta F11."; } } [HarmonyPatch(typeof(Teleport), "Interact")] internal static class DungeonInteractionContext { [HarmonyPrefix] [HarmonyPriority(800)] internal static void Prefix(Humanoid character, bool hold, out bool __state) { __state = DungeonTravelCompatibility.DungeonInteraction; DungeonTravelCompatibility.DungeonInteraction = true; if (!hold && character is Player && (Object)(object)character == (Object)(object)Player.m_localPlayer) { AdviceFeature.Queue("tamemate_dungeon_wait_0732", ModLanguage.IsEnglish ? "Waiting outside" : "Esperar afuera", DungeonTravelCompatibility.Advice(), "tamemate_guide"); } } [HarmonyFinalizer] internal static void Finalizer(bool __state) { DungeonTravelCompatibility.DungeonInteraction = __state; } } [HarmonyPatch] internal static class DungeonAutomaticTransitGate { [HarmonyTargetMethod] private static MethodBase TargetMethod() { return DungeonTravelCompatibility.Core("CompanionTeleport", "TransitCompanions"); } [HarmonyPrefix] internal static bool Prefix(Player player, Vector3 targetPos, Vector3? customOrigin) { //IL_0039: 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_003f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return false; } return !DungeonTravelPolicy.BlockTransit(((Vector3)(((??)customOrigin) ?? ((Component)player).transform.position)).y, targetPos.y, DungeonTravelCompatibility.DungeonInteraction); } } [HarmonyPatch] internal static class DungeonAutomaticRecoveryGate { [HarmonyTargetMethod] private static MethodBase TargetMethod() { return DungeonTravelCompatibility.Core("CompanionMotor", "TeleportToOwner"); } [HarmonyPrefix] internal static bool Prefix(Character ___character, Player owner) { //IL_0032: 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) if ((Object)(object)___character == (Object)null || (Object)(object)owner == (Object)null) { return false; } return !DungeonTravelPolicy.BlockRecovery(((Component)___character).transform.position.y, ((Component)owner).transform.position.y, DungeonTravelCompatibility.Staying(___character)); } } [HarmonyPatch] internal static class DungeonQueuedTransitGate { [HarmonyTargetMethod] private static MethodBase TargetMethod() { return DungeonTravelCompatibility.Core("CompanionTeleport", "WaitForAreaAndTransit"); } [HarmonyPostfix] private static void Postfix(Player player, ref IEnumerator __result) { if (__result != null) { __result = DungeonTravelCompatibility.GuardQueued(__result, player); } } } [HarmonyPatch(typeof(AdvicePolicy), "Text")] internal static class DungeonAdviceCorrection { [HarmonyPostfix] private static void Postfix(string key, ref string __result) { if (!(key != "tamemate_dungeon_rescue")) { __result = (ModLanguage.IsEnglish ? "In case you're as forgetful as Jen, I'm here to teach you!" : ModLanguage.Text("Por si eres como la Jen toda olvidadisa aqui estoy yo para ensarte!")) + "\n\n" + DungeonTravelCompatibility.Advice(); } } } [HarmonyPatch] internal static class DungeonGuideCorrection { private static readonly string[] Bases = new string[2]; private static readonly string[] Results = new string[2]; [HarmonyTargetMethod] private static MethodBase TargetMethod() { return DungeonTravelCompatibility.Core("TameMateGuidebook", "GetChapterSpanish"); } [HarmonyPostfix] private static void Postfix(int chapter, ref string content) { if (chapter == 2 && content != null) { int num = (ModLanguage.IsEnglish ? 1 : 0); if (object.ReferenceEquals(content, Bases[num])) { content = Results[num]; return; } Bases[num] = content; content = DungeonTravelCompatibility.Advice() + "\n\n" + content; Results[num] = content; } } } internal static class DungeonTravelPolicy { internal static bool BlockTransit(float originY, float targetY, bool dungeonInteraction) { return dungeonInteraction || originY > 1500f || targetY > 1500f; } internal static bool BlockRecovery(float creatureY, float ownerY, bool stay) { return stay || BlockTransit(creatureY, ownerY, dungeonInteraction: false); } } internal static class EquipmentCompatibility { private sealed class Eligibility { internal bool Allowed; } private static readonly Dictionary<GameObject, bool> Prefabs = new Dictionary<GameObject, bool>(); private static readonly ConditionalWeakTable<Character, Eligibility> Creatures = new ConditionalWeakTable<Character, Eligibility>(); internal static Type CoreType => AccessTools.TypeByName("TameMate.CompanionEquipment"); internal static bool Allowed(Character c) { if ((Object)(object)c == (Object)null || !c.IsTamed() || (Object)(object)ZNetScene.instance == (Object)null) { return false; } if (Creatures.TryGetValue(c, out var value)) { return value.Allowed; } string prefabName = Utils.GetPrefabName(((Component)c).gameObject); GameObject prefab = ZNetScene.instance.GetPrefab(prefabName); if ((Object)(object)prefab == (Object)null) { return false; } if (!Prefabs.TryGetValue(prefab, out var value2)) { VisEquipment componentInChildren = prefab.GetComponentInChildren<VisEquipment>(true); value2 = prefabName.IndexOf("greydwarf", StringComparison.OrdinalIgnoreCase) < 0 && (Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.m_rightHand != (Object)null && (Object)(object)componentInChildren.m_leftHand != (Object)null; if (Prefabs.Count > 256) { Prefabs.Clear(); } Prefabs[prefab] = value2; } Creatures.Add(c, new Eligibility { Allowed = value2 }); return value2; } internal static string Notice() { return ModLanguage.IsEnglish ? "This companion cannot wear equipment. Saddlebags remain storage. Use Alt + E to remove previous equipment." : "Esta criatura no admite equipo. Las alforjas son almacenamiento. Usa Alt + E para retirar el equipo anterior."; } internal static void Explain(Player player) { if (!((Object)(object)player == (Object)null)) { ((Character)player).Message((MessageType)2, Notice(), 0, (Sprite)null, false); AdviceFeature.Queue("tamemate_equipment_0731", ModLanguage.IsEnglish ? "Companion equipment" : "Equipo de compañeros", Notice(), "tamemate_guide"); } } } [HarmonyPatch] internal static class EquipmentManualGate { [HarmonyTargetMethod] private static MethodBase TargetMethod() { return AccessTools.Method(EquipmentCompatibility.CoreType, "TryEquip", (Type[])null, (Type[])null); } [HarmonyPrefix] internal static bool Prefix(Player player, Character c, ref bool __result) { if (EquipmentCompatibility.Allowed(c)) { return true; } __result = false; EquipmentCompatibility.Explain(player); return false; } } [HarmonyPatch] internal static class EquipmentAutomaticGate { [HarmonyTargetMethods] private static IEnumerable<MethodBase> TargetMethods() { try { string[] array = new string[3] { "AutoEquipFromInventory", "RefreshVisualEquipment", "AttachVisual" }; foreach (string method in array) { yield return AccessTools.Method(EquipmentCompatibility.CoreType, method, (Type[])null, (Type[])null); } } finally { } } [HarmonyPrefix] internal static bool Prefix(Character c) { return EquipmentCompatibility.Allowed(c); } } [HarmonyPatch] internal static class EquipmentHoverGate { [HarmonyTargetMethod] private static MethodBase TargetMethod() { return AccessTools.Method(EquipmentCompatibility.CoreType, "GetEquipmentHoverSummary", (Type[])null, (Type[])null); } [HarmonyPrefix] internal static bool Prefix(Character c, ref string __result) { if (EquipmentCompatibility.Allowed(c)) { return true; } __result = "\n<color=#FFE082>" + EquipmentCompatibility.Notice() + "</color>"; return false; } } [HarmonyPatch] internal static class EquipmentLegacyStatGate { [HarmonyTargetMethods] private static IEnumerable<MethodBase> TargetMethods() { try { string[] array = new string[6] { "Right", "Left", "Helmet", "Chest", "Legs", "Shoulder" }; foreach (string slot in array) { yield return AccessTools.Method(EquipmentCompatibility.CoreType, "GetEquipped" + slot + "Prefab", (Type[])null, (Type[])null); } } finally { } } [HarmonyPrefix] internal static bool Prefix(Character c, ref string __result) { if (EquipmentCompatibility.Allowed(c)) { return true; } __result = string.Empty; return false; } } [HarmonyPatch] internal static class EquipmentGuideGate { private static readonly string[] Bases = new string[2]; private static readonly string[] Results = new string[2]; [HarmonyTargetMethod] private static MethodBase TargetMethod() { return AccessTools.Method(AccessTools.TypeByName("TameMate.TameMateGuidebook"), "GetChapterSpanish", (Type[])null, (Type[])null); } [HarmonyPostfix] private static void Postfix(int chapter, ref string content) { if (content != null && chapter == 3) { int num = (ModLanguage.IsEnglish ? 1 : 0); if (object.ReferenceEquals(content, Bases[num])) { content = Results[num]; return; } string text = content; content += (ModLanguage.IsEnglish ? "\n\nEQUIPMENT: only companions with native equipment visuals and hand anchors can equip items; greydwarfs are excluded. Incompatible companions keep saddlebags as storage without auto-equipping. Alt + E remains available to remove older assignments. No automatic item migration is performed." : "\n\nEQUIPO: solo las criaturas con visuales nativos de equipo y anclajes de manos pueden equiparse; los grisucios quedan excluidos. Las incompatibles conservan las alforjas como almacenamiento sin autoequipado. Alt + E permite retirar asignaciones anteriores. No se realiza una migración automática de objetos."); Bases[num] = text; Results[num] = content; } } } [HarmonyPatch] internal static class CompanionHandScalePatch { [HarmonyTargetMethod] private static MethodBase TargetMethod() { return AccessTools.Method(AccessTools.TypeByName("TameMate.CompanionEquipment"), "ApplyColossalWeaponScale", (Type[])null, (Type[])null); } [HarmonyPrefix] internal static bool Prefix(Character c) { return (Object)(object)c == (Object)null || !c.IsTamed(); } } [HarmonyPatch] internal static class CompanionAttachmentScalePatch { [HarmonyTargetMethod] private static MethodBase TargetMethod() { return AccessTools.Method(AccessTools.TypeByName("TameMate.CompanionEquipment"), "AttachVisual", (Type[])null, (Type[])null); } [HarmonyPostfix] internal static void Postfix(Character c, string prefabName, string slot) { //IL_0151: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)c == (Object)null || !c.IsTamed() || string.IsNullOrEmpty(prefabName) || (slot != "right" && slot != "left" && slot != "helmet") || (Object)(object)((Component)c).GetComponentInChildren<VisEquipment>() != (Object)null) { return; } GameObject val = (((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab(prefabName) : null); if ((Object)(object)val == (Object)null && (Object)(object)ZNetScene.instance != (Object)null) { val = ZNetScene.instance.GetPrefab(prefabName); } if ((Object)(object)val == (Object)null) { return; } string text = "TM_Visual_" + slot; Transform[] componentsInChildren = ((Component)c).GetComponentsInChildren<Transform>(true); foreach (Transform val2 in componentsInChildren) { if ((Object)(object)val2 != (Object)null && ((Object)val2).name == text) { val2.localScale = val.transform.localScale; } } } } public static class GlobalBalance { private static readonly ManualLogSource Log = Logger.CreateLogSource("TameMate Global Balance"); private static bool applying; private static int selected = 1; public static int Current => selected; public static bool MayWriteExternal() { return GlobalBalancePolicy.MayWriteExternal((Object)(object)ZNet.instance != (Object)null, (Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsServer()); } public static int BossStarsForCap(int stars) { return GlobalBalancePolicy.BossStarsForCap(stars); } public static void Configure(Assembly core) { CombatBudgetRuntime0738.Configure(core); if (!(core == null)) { PropertyInfo property = core.GetType("TameMate.DifficultyManager").GetProperty("Current"); ApplyPreset(Convert.ToInt32(property.GetValue(null, null), CultureInfo.InvariantCulture)); PatchStarLevels(); } } public static void Select(int difficulty) { selected = ((difficulty < 0 || difficulty >= 4) ? 1 : difficulty); } public static void ApplyNativeCombat() { if (!((Object)(object)Game.instance == (Object)null)) { GlobalBalancePreset globalBalancePreset = GlobalBalancePolicy.Get(selected); Game.m_playerDamageRate = globalBalancePreset.PlayerDamage; Game.m_enemyDamageRate = globalBalancePreset.EnemyDamage; Game.m_enemySpeedSize = globalBalancePreset.EnemySpeedSize; Game.m_enemyLevelUpRate = globalBalancePreset.LevelUpRate; } } public static void SyncNativeCombat() { if (!((Object)(object)ZoneSystem.instance == (Object)null) && MayWriteExternal()) { GlobalBalancePreset globalBalancePreset = GlobalBalancePolicy.Get(selected); ZoneSystem.instance.SetGlobalKey((GlobalKeys)14, globalBalancePreset.EnemySpeedSize * 100f); ZoneSystem.instance.SetGlobalKey((GlobalKeys)15, globalBalancePreset.LevelUpRate * 100f); } } public static void ApplyPreset(int difficulty) { Select(difficulty); if (applying || !MayWriteExternal()) { return; } applying = true; try { GlobalBalancePreset globalBalancePreset = GlobalBalancePolicy.Get(selected); foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { if (pluginInfo.Key.IndexOf("StarLevelSystem", StringComparison.OrdinalIgnoreCase) >= 0 && !((Object)(object)pluginInfo.Value.Instance == (Object)null)) { ConfigFile config = pluginInfo.Value.Instance.Config; bool saveOnConfigSet = config.SaveOnConfigSet; config.SaveOnConfigSet = false; try { Set(config, "LevelSystem", "MaxLevel", globalBalancePreset.Stars); Set(config, "LevelSystem", "MaxBossLevel", globalBalancePreset.BossStars); Set(config, "LevelSystem", "EnemyHealthMultiplier", globalBalancePreset.HealthPerStar); Set(config, "LevelSystem", "EnemyDamageLevelMultiplier", globalBalancePreset.DamagePerStar); Set(config, "LevelSystem", "BossEnemyHealthMultiplier", globalBalancePreset.BossHealthPerStar); Set(config, "LevelSystem", "BossEnemyDamageMultiplier", globalBalancePreset.BossDamagePerStar); Set(config, "LevelSystem", "OverLevelTamesGetRerolledOnLoad", false); Set(config, "Modifiers", "EnableBossModifiers", globalBalancePreset.BossModifiers > 0); Set(config, "Modifiers", "MaxBossModifiersPerBoss", globalBalancePreset.BossModifiers); Set(config, "Modifiers", "ChanceOfBossModifier", globalBalancePreset.BossModifierChance); Set(config, "Modifiers", "MaxMajorModifiersPerCreature", (selected < 2) ? 1 : 2); Set(config, "Modifiers", "MaxMinorModifiersPerCreature", (selected < 2) ? 1 : 2); Set(config, "Modifiers", "ChanceMajorModifier", (new float[4] { 0.08f, 0.15f, 0.2f, 0.25f })[selected]); Set(config, "Modifiers", "ChanceMinorModifier", (new float[4] { 0.15f, 0.25f, 0.3f, 0.35f })[selected]); Set(config, "Multiplayer", "MultiplayerEnemyHealthModifier", (new float[4] { 0.08f, 0.1f, 0.12f, 0.15f })[selected]); Set(config, "Multiplayer", "MultiplayerEnemyDamageModifier", (new float[4] { 0.01f, 0.02f, 0.03f, 0.04f })[selected]); Set(config, "Multiplayer", "MultiplayerScalingRequiredPlayersNearby", 3); Set(config, "Multiplayer", "MultiplayerEnemyMinDamageTaken", 0.35f); config.Save(); } finally { config.SaveOnConfigSet = saveOnConfigSet; } Log.LogInfo((object)("Preset " + selected + ": SLS cap " + globalBalancePreset.Stars + " stars, bosses " + globalBalancePreset.BossStars + "; HP/star " + globalBalancePreset.HealthPerStar + ", damage/star " + globalBalancePreset.DamagePerStar + ". Existing caches refresh through SLS; reconnect for a clean comparison.")); } } } catch (Exception ex) { Log.LogWarning((object)("Global balance not fully applied: " + ex.Message)); } finally { applying = false; } } private static void Set(ConfigFile cfg, string section, string key, object value) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown ConfigDefinition val = new ConfigDefinition(section, key); if (!cfg.ContainsKey(val)) { Log.LogWarning((object)("SLS setting missing: " + section + "/" + key)); return; } ConfigEntryBase val2 = cfg[val]; object obj = Convert.ChangeType(value, val2.SettingType, CultureInfo.InvariantCulture); if (!object.Equals(val2.BoxedValue, obj)) { val2.BoxedValue = obj; } } private static void PatchStarLevels() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown Type type = AccessTools.TypeByName("StarLevelSystem.modules.LevelSystem.LevelSelection"); if (type == null) { Log.LogInfo((object)"SLS absent: native creature levels retained."); return; } Harmony val = new Harmony("mitsu.tamemate.globalbalance.070"); MethodInfo methodInfo = AccessTools.Method(type, "GetMaxCreatureLevel", (Type[])null, (Type[])null); if (methodInfo != null) { val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(GlobalBalance), "CapResult", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } int num = 0; MethodInfo[] methods = type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo2 in methods) { ParameterInfo[] parameters = methodInfo2.GetParameters(); if (!(methodInfo2.Name != "DetermineLevel") && parameters.Length != 0 && !(parameters[0].ParameterType != typeof(Character))) { val.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(GlobalBalance), "LevelResult", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); num++; } } if (methodInfo == null || num != 1) { Log.LogWarning((object)"SLS level bridge shape changed; inspect before publishing."); } else { Log.LogInfo((object)"SLS biome/conditional/prefab caps bounded by global preset; tamed creatures excluded."); } } private static bool Exempt(Character character) { return (Object)(object)character == (Object)null || character.IsPlayer() || character.IsTamed(); } private static void CapResult(Character __0, ref int __result, bool? __4) { __result = GlobalBalancePolicy.Limit(__result, Current, __4 ?? ((Object)(object)__0 != (Object)null && __0.IsBoss()), Exempt(__0)); } private static void LevelResult(Character __0, ref int __result) { __result = GlobalBalancePolicy.Limit(__result, Current, (Object)(object)__0 != (Object)null && __0.IsBoss(), Exempt(__0)); } public static string Summary(int difficulty, bool english) { return BalanceGuide0738.Summary(difficulty, english); } public static string AppendGuide(string content) { return BjornMount0739.Guide(BalanceGuide0738.Append(content)); } } public sealed class GlobalBalancePreset { public readonly int Stars; public readonly int BossStars; public readonly int BossModifiers; public readonly float HealthPerStar; public readonly float DamagePerStar; public readonly float BossHealthPerStar; public readonly float BossDamagePerStar; public readonly float BossModifierChance; public readonly float PlayerDamage; public readonly float EnemyDamage; public readonly float EnemySpeedSize; public readonly float LevelUpRate; public readonly float PlayerXp; internal GlobalBalancePreset(int stars, int bosses, float hp, float damage, float bossHp, float bossDamage, int modifiers, float chance, float playerDamage, float enemyDamage, float speed, float levelUp, float xp) { Stars = stars; BossStars = bosses; HealthPerStar = hp; DamagePerStar = damage; BossHealthPerStar = bossHp; BossDamagePerStar = bossDamage; BossModifiers = modifiers; BossModifierChance = chance; PlayerDamage = playerDamage; EnemyDamage = enemyDamage; EnemySpeedSize = speed; LevelUpRate = levelUp; PlayerXp = xp; } } public static class GlobalBalancePolicy { private static readonly GlobalBalancePreset[] Presets = new GlobalBalancePreset[4] { new GlobalBalancePreset(3, 2, 0.75f, 0.35f, 0.2f, 0.03f, 0, 0f, 0.9f, 0.9f, 0.98f, 1.05f, 1.5f), new GlobalBalancePreset(5, 3, 1f, 0.5f, 0.25f, 0.04f, 1, 0.25f, 0.88f, 1.15f, 1.03f, 1.1f, 1.25f), new GlobalBalancePreset(8, 4, 1.1f, 0.55f, 0.3f, 0.05f, 2, 0.5f, 0.8f, 1.65f, 1.12f, 1.25f, 1.1f), new GlobalBalancePreset(12, 5, 1.2f, 0.6f, 0.35f, 0.06f, 3, 0.75f, 0.65f, 2.15f, 1.22f, 1.45f, 1f) }; public static GlobalBalancePreset Get(int difficulty) { return Presets[(difficulty < 0 || difficulty >= 4) ? 1 : difficulty]; } public static int Limit(int nativeLevel, int difficulty, bool boss, bool exempt) { if (exempt || nativeLevel <= 0) { return nativeLevel; } GlobalBalancePreset globalBalancePreset = Get(difficulty); return Math.Min(nativeLevel, (boss ? globalBalancePreset.BossStars : globalBalancePreset.Stars) + 1); } public static bool MayWriteExternal(bool networkExists, bool server) { return !networkExists || server; } public static int BossStarsForCap(int stars) { GlobalBalancePreset[] presets = Presets; foreach (GlobalBalancePreset globalBalancePreset in presets) { if (globalBalancePreset.Stars == stars) { return globalBalancePreset.BossStars; } } return Math.Max(0, stars); } } public static class GuideEvents { public static void Difficulty(int preset, bool announce) { BalanceGuide0738.Advice(preset, announce); } public static void BloodMoon(bool active, bool announce) { AdvicePresentation0737.BloodMoon(active, announce); } public static void Rejected() { AdviceFeature.Queue("tamemate_taming_rejected", ModLanguage.Text("La criatura ha rechazado el vínculo"), ModLanguage.Text("La doma de combate comienza con 30% al nivel mínimo efectivo; Cataclysm o No-muerto comienzan con 20%, y ambos combinados con 10%. Cada nivel adicional suma 5 puntos. Un rechazo añade +10% vida y daño, hasta +30%, y bloquea otro intento durante 30 segundos. Esa furia desaparece al aceptar la doma. Consulta requisitos y dificultad en F11."), "tamemate_guide"); } public static void Altar(string altar, string name) { AdviceFeature.Queue("tamemate_altar_" + altar, ModLanguage.Text("Un nuevo rival: ") + name, ModLanguage.Text("Has cumplido el requisito de progreso y el altar existente más cercano de ") + name + ModLanguage.Text(" está señalado en el mapa. Conserva sus trofeos para consagrar su pasiva desde el inventario. F11 explica requisitos, pasivas y progresión de biomas."), "tamemate_guide"); } public static void OceanSummoned() { AdviceFeature.Queue("tamemate_ocean_summoned", ModLanguage.Text("Jörmungandr ha emergido"), ModLanguage.Text("El Cuerno de las Mareas es reutilizable: los materiales y trofeos se pagan al fabricarlo. Derrota a Jörmungandr y recoge su trofeo flotante para consagrar Dominio Abisal. Consulta F11 para ver beneficios y costes por rango."), "tamemate_guide"); } } internal static class LanguageCatalog { internal sealed class Entry { public string Source; public string Spanish; public string English; public string Token; public Entry(string s, string p, string e, string t) { Source = s; Spanish = p; English = e; Token = t; } } internal static readonly Entry[] Entries = new Entry[674] { new Entry(" [TAMEMATE] REPORTE DE PREPARACIÓN DE BIOMA Y PROGRESIÓN", " [TAMEMATE] REPORTE DE PREPARACIÓN DE BIOMA Y PROGRESIÓN", " [TAMEMATE] BIOME READINESS AND PROGRESSION REPORT", "tm071_text_0"), new Entry(" Sinergias Bestia: +{0}% Daño | +{1}% Defensa", " Sinergias Bestia: +{0}% Daño | +{1}% Defensa", " Beast synergy: +{0}% Damage | +{1}% Defense", "tm071_text_1"), new Entry(" (Daño +", " (Daño +", " (Damage +", "tm071_text_2"), new Entry(" (modificadores del tier).", " (modificadores del tier).", " (tier modifiers).", "tm071_text_3"), new Entry(" (una vez); topes ", " (una vez); topes ", " (once); caps ", "tm071_text_5"), new Entry(" | criaturas aparecidas desde el aviso anterior: ", " | criaturas aparecidas desde el aviso anterior: ", " | creatures spawned since the previous notice: ", "tm071_text_6"), new Entry(" | Jefe del Bioma: ", " | Jefe del Bioma: ", " | Biome boss: ", "tm071_text_7"), new Entry(" · <color=#E8C673>TameMate</color> · Nv. ", " · <color=#E8C673>TameMate</color> · Nv. ", " · <color=#E8C673>TameMate</color> · Lv. ", "tm071_text_9"), new Entry(" · Grupo ", " · Grupo ", " · Group ", "tm071_text_10"), new Entry(" • Artes Culinarias: Nv. {0:F0} (Duración Comida +{1}%, Nutrición +{2}%)", " • Artes Culinarias: Nv. {0:F0} (Duración Comida +{1}%, Nutrición +{2}%)", " • Culinary Arts: Lv. {0:F0} (Food duration +{1}%, Nutrition +{2}%)", "tm071_text_12"), new Entry(" • Artes Viscerales: Nv. {0:F0} (Ventana Riposte {1:F1}s, +{2:F0} Aguante Esquiva)", " • Artes Viscerales: Nv. {0:F0} (Ventana Riposte {1:F1}s, +{2:F0} Aguante Esquiva)", " • Visceral Arts: Lv. {0:F0} (Riposte window {1:F1}s, +{2:F0} dodge stamina)", "tm071_text_13"), new Entry(" • Caza Ancestral: Nv. {0:F0} (Botín Fauna +{1}%, Trofeos +{2}%)", " • Caza Ancestral: Nv. {0:F0} (Botín Fauna +{1}%, Trofeos +{2}%)", " • Ancestral Hunting: Lv. {0:F0} (Wildlife loot +{1}%, Trophies +{2}%)", "tm071_text_14"), new Entry(" • Herrería y Forja: Nv. {0:F0} (Durabilidad Equipo +{1}%)", " • Herrería y Forja: Nv. {0:F0} (Durabilidad Equipo +{1}%)", " • Smithing and Forge: Lv. {0:F0} (Equipment durability +{1}%)", "tm071_text_15"), new Entry(" • Maestría del Hogar: Nv. {0:F0} (Doble Cosecha {1}%, Descanso +{2}m)", " • Maestría del Hogar: Nv. {0:F0} (Doble Cosecha {1}%, Descanso +{2}m)", " • Hearth Mastery: Lv. {0:F0} (Double harvest {1}%, Rested +{2}m)", "tm071_text_16"), new Entry(" • Navegación Nórdica: Nv. {0:F0} (Velocidad Barco +{1}%)", " • Navegación Nórdica: Nv. {0:F0} (Velocidad Barco +{1}%)", " • Nordic Navigation: Lv. {0:F0} (Ship speed +{1}%)", "tm071_text_17"), new Entry(" • Ojo Cazador Apex: Nv. {0:F0} (Suelo Daño {1}%, Sobrecarga {2}%)", " • Ojo Cazador Apex: Nv. {0:F0} (Suelo Daño {1}%, Sobrecarga {2}%)", " • Apex Hunter's Eye: Lv. {0:F0} (Damage floor {1}%, Overload {2}%)", "tm071_text_18"), new Entry(" • Poder Primitivo: Nv. {0:F0} (Peso Máximo +{1}kg, Empuje +{2}%)", " • Poder Primitivo: Nv. {0:F0} (Peso Máximo +{1}kg, Empuje +{2}%)", " • Primitive Power: Lv. {0:F0} (Carry weight +{1}kg, Push +{2}%)", "tm071_text_19"), new Entry(" • Susurro Ultratumba: Nv. {0:F0} (Robo de Vida {1}%, Toppings {2}m)", " • Susurro Ultratumba: Nv. {0:F0} (Robo de Vida {1}%, Toppings {2}m)", " • Underworld Whisper: Lv. {0:F0} (Life steal {1}%, Food buffs {2}m)", "tm071_text_20"), new Entry(" • Temple Primal: Nv. {0:F0} (Mitigación Asedio -{1}%, Nutrición +{2}%)", " • Temple Primal: Nv. {0:F0} (Mitigación Asedio -{1}%, Nutrición +{2}%)", " • Primal Resolve: Lv. {0:F0} (Siege mitigation -{1}%, Nutrition +{2}%)", "tm071_text_21"), new Entry(" • Vínculo de Manada: Nv. {0:F0} (+{1}% Vel. Bestia, -{2}% Aguante Monta)", " • Vínculo de Manada: Nv. {0:F0} (+{1}% Vel. Bestia, -{2}% Aguante Monta)", " • Pack Bond: Lv. {0:F0} (+{1}% beast speed, -{2}% riding stamina)", "tm071_text_22"), new Entry(" • Vitalidad Vikinga: Nv. {0:F0} (Salud Máx. +{1} HP, Regen. +{2}%)", " • Vitalidad Vikinga: Nv. {0:F0} (Salud Máx. +{1} HP, Regen. +{2}%)", " • Viking Vitality: Lv. {0:F0} (Max health +{1} HP, Regen +{2}%)", "tm071_text_23"), new Entry(" 1. Armadura y Equipo: {0:F0} / {1:F0} objetivo (Puntaje: {2:F1}/25)", " 1. Armadura y Equipo: {0:F0} / {1:F0} objetivo (Puntaje: {2:F1}/25)", " 1. Armor and gear: {0:F0} / {1:F0} target (Score: {2:F1}/25)", "tm071_text_24"), new Entry(" 2. Vitalidad y Nutrición: {0:F0} HP / {1:F0} obj. | {2:F0} Aguante | {3}/3 comidas (Puntaje: {4:F1}/20)", " 2. Vitalidad y Nutrición: {0:F0} HP / {1:F0} obj. | {2:F0} Aguante | {3}/3 comidas (Puntaje: {4:F1}/20)", " 2. Health and nutrition: {0:F0} HP / {1:F0} target | {2:F0} Stamina | {3}/3 foods (Score: {4:F1}/20)", "tm071_text_25"), new Entry(" 3. Destreza de Armas: {0} Nv. {1:F0} / {2:F0} obj. (Puntaje: {3:F1}/20)", " 3. Destreza de Armas: {0} Nv. {1:F0} / {2:F0} obj. (Puntaje: {3:F1}/20)", " 3. Weapon skill: {0} Lv. {1:F0} / {2:F0} target (Score: {3:F1}/20)", "tm071_text_26"), new Entry(" 4. Nivel y Stats MMO: [EpicMMO no instalado - bonos compensados en Equipo y Habilidades]", " 4. Nivel y Stats MMO: [EpicMMO no instalado - bonos compensados en Equipo y Habilidades]", " 4. MMO level and stats: [EpicMMO not installed - bonuses offset through gear and skills]", "tm071_text_27"), new Entry(" 4. Nivel y Stats MMO: Nivel {0} / {1} obj. (Puntaje: {2:F1}/15)", " 4. Nivel y Stats MMO: Nivel {0} / {1} obj. (Puntaje: {2:F1}/15)", " 4. MMO level and stats: Level {0} / {1} target (Score: {2:F1}/15)", "tm071_text_28"), new Entry(" 5. Compañero Activo: {0} (Tier {1}, Nv. {2}) / Obj: Tier {3} Nv. {4} (Puntaje: {5:F1}/20)", " 5. Compañero Activo: {0} (Tier {1}, Nv. {2}) / Obj: Tier {3} Nv. {4} (Puntaje: {5:F1}/20)", " 5. Active companion: {0} (Tier {1}, Lv. {2}) / Target: Tier {3} Lv. {4} (Score: {5:F1}/20)", "tm071_text_29"), new Entry(" 5. Compañero Activo: Ninguno cerca (Puntaje: 0/20) - [Se recomienda domesticar una bestia]", " 5. Compañero Activo: Ninguno cerca (Puntaje: 0/20) - [Se recomienda domesticar una bestia]", " 5. Active companion: None nearby (Score: 0/20) - [Tame a beast to improve readiness]", "tm071_text_30"), new Entry(" añade un nivel de ascensión a su bioma. Se suma a los otros jefes de esa región, aunque BiomeLords use progreso personal. Repetir el mismo jefe no añade otro nivel. El preset determina el daño adicional; los tiers y las nuevas apariciones reflejan la progresión. Consulta F11.", " añade un nivel de ascensión a su bioma. Se suma a los otros jefes de esa región, aunque BiomeLords use progreso personal. Repetir el mismo jefe no añade otro nivel. El preset determina el daño adicional; los tiers y las nuevas apariciones reflejan la progresión. Consulta F11.", " adds one ascension stage to its biome. It stacks with other bosses in that region, even when BiomeLords uses personal progress. Defeating the same boss again adds no stage. Your preset determines the extra damage; tiers and new spawns reflect progression. See F11.", "tm071_text_32"), new Entry(" Bioma Actual: ", " Bioma Actual: ", " Current biome: ", "tm071_text_33"), new Entry(" debes portar su Trofeo en tu inventario.", " debes portar su Trofeo en tu inventario.", " you must carry its trophy in your inventory.", "tm071_text_34"), new Entry(" disponible", " disponible", " available", "tm071_text_35"), new Entry(" en Atributos</color>", " en Atributos</color>", " in Attributes</color>", "tm071_text_36"), new Entry(" en inventario para domarlo.", " en inventario para domarlo.", " in your inventory to tame it.", "tm071_text_37"), new Entry(" está señalado en el mapa. Conserva sus trofeos para consagrar su pasiva desde el inventario. F11 explica requisitos, pasivas y progresión de biomas.", " está señalado en el mapa. Conserva sus trofeos para consagrar su pasiva desde el inventario. F11 explica requisitos, pasivas y progresión de biomas.", " is marked on your map. Keep its trophies to consecrate its passive from your inventory. F11 explains requirements, passives and biome progression.", "tm071_text_39"), new Entry(" Estado: ", " Estado: ", " Status: ", "tm071_text_40"), new Entry(" estrellas / jefes ", " estrellas / jefes ", " stars / bosses ", "tm071_text_41"), new Entry(" ha ascendido a ", " ha ascendido a ", " has ascended to ", "tm071_text_42"), new Entry(" ha renacido como No-Muerto hostil [Undead]!</color>", " ha renacido como No-Muerto hostil [Undead]!</color>", " has risen as a hostile Undead!</color>", "tm071_text_43"), new Entry(" ha renacido como tu Compañero No-Muerto conservando su inventario!</color>", " ha renacido como tu Compañero No-Muerto conservando su inventario!</color>", " has risen as your Undead companion, keeping its inventory!</color>", "tm071_text_44"), new Entry(" HABILIDADES NATIVAS NÓRDICAS (12 Árboles):", " HABILIDADES NATIVAS NÓRDICAS (12 Árboles):", " NATIVE NORDIC SKILLS (12 TREES):", "tm071_text_45"), new Entry(" Índice de Preparación General: {0}% [{1}]", " Índice de Preparación General: {0}% [{1}]", " Overall readiness: {0}% [{1}]", "tm071_text_48"), new Entry(" jura lealtad como tu compañero!", " jura lealtad como tu compañero!", " pledges loyalty as your companion!", "tm071_text_50"), new Entry(" mediante RideOnTroll.", " mediante RideOnTroll.", " through RideOnTroll.", "tm071_text_51"), new Entry(" mitigados (-75%)", " mitigados (-75%)", " mitigated (-75%)", "tm071_text_52"), new Entry(" No-muerto", " No-muerto", " Undead", "tm071_text_53"), new Entry(" punto", " punto", " point", "tm071_text_54"), new Entry(" reanimada con éxito como Tier Undead.", " reanimada con éxito como Tier Undead.", " successfully reanimated as Undead.", "tm071_text_55"), new Entry(" reanimado con éxito como No-Muerto leal [Undead].", " reanimado con éxito como No-Muerto leal [Undead].", " successfully reanimated as a loyal Undead.", "tm071_text_56"), new Entry(" RECOMENDACIONES TÁCTICAS PARA AVANZAR:", " RECOMENDACIONES TÁCTICAS PARA AVANZAR:", " TACTICAL RECOMMENDATIONS FOR ADVANCING:", "tm071_text_57"), new Entry(" se ha equipado ", " se ha equipado ", " equipped ", "tm071_text_59"), new Entry(" se ha equipado armamento óptimo de sus alforjas!", " se ha equipado armamento óptimo de sus alforjas!", " equipped the best available gear from its saddlebags!", "tm071_text_60"), new Entry(" solicitado", " solicitado", " requested", "tm071_text_61"), new Entry(" ya ha alcanzado la Maestría Suprema (Rango 3/3).</color>", " ya ha alcanzado la Maestría Suprema (Rango 3/3).</color>", " has already reached Supreme Mastery (Rank 3/3).</color>", "tm071_text_65"), new Entry("\n\n<b>Balance global 0.7.45</b>\nUn mundo usa una dificultad global del anfitrión; no se mezcla Fácil para un jugador y Difícil para otro. Cambiar el preset ajusta Valheim, SLS y EpicMMO instalados.\nFácil: daño jugador/enemigo x0.90/x0.90; máximo 3 estrellas / jefes 2; vida por estrella +75% / jefes +20%; daño por estrella +35% / jefes +3%; XP MMO x1.5.\nNormal: daño jugador/enemigo x0.88/x1.15; máximo 5 / jefes 3; vida por estrella +100% / jefes +25%; daño por estrella +50% / jefes +4%; XP MMO x1.25.\nDifícil: daño jugador/enemigo x0.80/x1.65; máximo 8 / jefes 4; vida por estrella +110% / jefes +30%; daño por estrella +55% / jefes +5%; XP MMO x1.1.\nSupreme: daño jugador/enemigo x0.65/x2.15; máximo 12 / jefes 5; vida por estrella +120% / jefes +35%; daño por estrella +60% / jefes +6%; XP MMO x1.\nBase de combate superior a Fácil/Normal/Difícil/Muy difícil vanilla, comparando el mismo enemigo y equipo. Sin regalos de vida, aguante base ni Eitr sin comida; 5 puntos MMO por nivel. Las builds, equipo, domas y pasivas pueden cambiar el resultado del combate.\nLos topes no garantizan estrellas: bioma, distancia, noche y progreso siguen influyendo, dentro del techo global. Las domas existentes conservan estrellas. Vida y daño base se combinan con equipo, atributos MMO, tiers, ascensión, Luna de Sangre y modificadores. No son porcentajes finales de todo el combate.\nEl daño del preset se aplica una sola vez en Valheim. SLS gestiona las estrellas sin añadir encima el escalado vanilla. Cambia la dificultad y reentra para comparar criaturas con cachés nuevas. Los puntos MMO ya ganados no se retiran ni se regalan al cambiar preset.", "\n\n<b>Balance global 0.7.45</b>\nUn mundo usa una dificultad global del anfitrión; no se mezcla Fácil para un jugador y Difícil para otro. Cambiar el preset ajusta Valheim, SLS y EpicMMO instalados.\nFácil: daño jugador/enemigo x0.90/x0.90; máximo 3 estrellas / jefes 2; vida por estrella +75% / jefes +20%; daño por estrella +35% / jefes +3%; XP MMO x1.5.\nNormal: daño jugador/enemigo x0.88/x1.15; máximo 5 / jefes 3; vida por estrella +100% / jefes +25%; daño por estrella +50% / jefes +4%; XP MMO x1.25.\nDifícil: daño jugador/enemigo x0.80/x1.65; máximo 8 / jefes 4; vida por estrella +110% / jefes +30%; daño por estrella +55% / jefes +5%; XP MMO x1.1.\nSupreme: daño jugador/enemigo x0.65/x2.15; máximo 12 / jefes 5; vida por estrella +120% / jefes +35%; daño por estrella +60% / jefes +6%; XP MMO x1.\nBase de combate superior a Fácil/Normal/Difícil/Muy difícil vanilla, comparando el mismo enemigo y equipo. Sin regalos de vida, aguante base ni Eitr sin comida; 5 puntos MMO por nivel. Las builds, equipo, domas y pasivas pueden cambiar el resultado del combate.\nLos topes no garantizan estrellas: bioma, distancia, noche y progreso siguen influyendo, dentro del techo global. Las domas existentes conservan estrellas. Vida y daño base se combinan con equipo, atributos MMO, tiers, ascensión, Luna de Sangre y modificadores. No son porcentajes finales de todo el combate.\nEl daño del preset se aplica una sola vez en Valheim. SLS gestiona las estrellas sin añadir encima el escalado vanilla. Cambia la dificultad y reentra para comparar criaturas con cachés nuevas. Los puntos MMO ya ganados no se retiran ni se regalan al cambiar preset.", "\n\n<b>Global balance 0.7.45</b>\nA world uses the host's global difficulty; Easy and Hard cannot be mixed per player. Presets coordinate Valheim, SLS and EpicMMO when installed.\nEasy: player/enemy damage x0.90/x0.90; creature/boss star caps 3/2; health per star +75%/+20%; damage per star +35%/+3%; MMO XP x1.5.\nNormal: damage x0.88/x1.15; caps 5/3; health per star +100%/+25%; damage per star +50%/+4%; MMO XP x1.25.\nHard: damage x0.80/x1.65; caps 8/4; health per star +110%/+30%; damage per star +55%/+5%; MMO XP x1.1.\nSupreme: damage x0.65/x2.15; caps 12/5; health per star +120%/+35%; damage per star +60%/+6%; MMO XP x1.\nThe combat baseline is tougher than the corresponding vanilla Easy/Normal/Hard/Very Hard setting for the same enemy and equipment. No free base health, stamina or foodless Eitr; 5 MMO points per level. Builds, gear, tames and passives affect actual combat.\nCaps do not guarantee stars: biome, distance, night and progression still matter. Existing tames keep their stars. Base health and damage combine with equipment, MMO attributes, tiers, ascension, Blood Moon and modifiers; these are not final combat percentages.\nPreset damage is applied once through Valheim. SLS handles stars without an additional vanilla star-scaling layer. Change difficulty and rejoin for fresh creature caches. Previously earned MMO points are not granted or removed when changing presets.", "tm071_text_66"), new Entry("\n\n<b>Guía TameMate:</b> pulsa F11 para consultar controles, requisitos, dificultad y pasivas.", "\n\n<b>Guía TameMate:</b> pulsa F11 para consultar controles, requisitos, dificultad y pasivas.", "\n\n<b>TameMate guide:</b> press F11 for controls, requirements, difficulty and passives.", "tm071_text_67"), new Entry("\n\n<b>PROGRESIÓN DE BIOMAS Y JEFES</b>\n", "\n\n<b>PROGRESIÓN DE BIOMAS Y JEFES</b>\n", "\n\n<b>BIOME AND BOSS PROGRESSION</b>\n", "tm071_text_68"), new Entry("\n\nASCENSIÓN DE BIOMAS: cada primera victoria mundial de un jefe asociado suma una etapa. Praderas: Eikthyr, Asmodeus, Neck Lord; Bosque Negro: El Sabio, Svålt, Greydwarf Lord; Pantano: Masaósea, Vrykolathas, Draugr Lord; Montaña: Moder, Brutalis, Fenring Lord; Planicies: Yagluth, Sythrak, Lox Lord; Brumosas: Reina, Seeker Lord; Ceniza: Fader, Valquiria Lord; Norte: Frozen King final, Gammeltroll Lord; Océano: Jörmungandr, Masaósea, Moder. Solo cuentan jefes presentes y derrotados.\nDaño salvaje adicional por etapa: Fácil +5%, Normal +15%, Difícil +25%, Supreme +40%; se suman etapas distintas (en Difícil, tres etapas: x1.75). Repetir un jefe no suma otra etapa. Las promociones de tier dependen de especie y estrellas; la vida de nuevas apariciones refleja el tier. Las nuevas derrotas de Lords cuentan globalmente aunque su mod use progreso personal.\nALTARES MONSTRUM: Eikthyr revela Asmodeus, El Sabio revela Svålt y Masaósea revela Vrykolathas, siempre que el altar exista registrado en el mundo. Si falta su registro, el servidor intenta recuperar automáticamente un solo altar con el generador nativo y las reglas originales de Monstrum, únicamente en zonas sin explorar. Después lo revela al jugador. No necesitas volver a matar al jefe ni ejecutar Upgrade World. No se regeneran otras ubicaciones ni se alteran zonas exploradas. Si no existe terreno válido, el log explica el fallo; no se fuerza un marcador falso.", "\n\nASCENSIÓN DE BIOMAS: cada primera victoria mundial de un jefe asociado suma una etapa. Praderas: Eikthyr, Asmodeus, Neck Lord; Bosque Negro: El Sabio, Svålt, Greydwarf Lord; Pantano: Masaósea, Vrykolathas, Draugr Lord; Montaña: Moder, Brutalis, Fenring Lord; Planicies: Yagluth, Sythrak, Lox Lord; Brumosas: Reina, Seeker Lord; Ceniza: Fader, Valquiria Lord; Norte: Frozen King final, Gammeltroll Lord; Océano: Jörmungandr, Masaósea, Moder. Solo cuentan jefes presentes y derrotados.\nDaño salvaje adicional por etapa: Fácil +5%, Normal +15%, Difícil +25%, Supreme +40%; se suman etapas distintas (en Difícil, tres etapas: x1.75). Repetir un jefe no suma otra etapa. Las promociones de tier dependen de especie y estrellas; la vida de nuevas apariciones refleja el tier. Las nuevas derrotas de Lords cuentan globalmente aunque su mod use progreso personal.\nALTARES MONSTRUM: Eikthyr revela Asmodeus, El Sabio revela Svålt y Masaósea revela Vrykolathas, siempre que el altar exista registrado en el mundo. Si falta su registro, el servidor intenta recuperar automáticamente un solo altar con el generador nativo y las reglas originales de Monstrum, únicamente en zonas sin explorar. Después lo revela al jugador. No necesitas volver a matar al jefe ni ejecutar Upgrade World. No se regeneran otras ubicaciones ni se alteran zonas exploradas. Si no existe terreno válido, el log explica el fallo; no se fuerza un marcador falso.", "\n\nBIOME ASCENSION: each first world victory over an associated boss adds one stage. Meadows: Eikthyr, Asmodeus, Neck Lord; Black Forest: The Elder, Svålt, Greydwarf Lord; Swamp: Bonemass, Vrykolathas, Draugr Lord; Mountain: Moder, Brutalis, Fenring Lord; Plains: Yagluth, Sythrak, Lox Lord; Mistlands: The Queen, Seeker Lord; Ashlands: Fader, Valkyrie Lord; Deep North: final Frozen King, Gammeltroll Lord; Ocean: Jörmungandr, Bonemass, Moder. Only bosses that are present and defeated count.\nExtra wild damage per stage: Easy +5%, Normal +15%, Hard +25%, Supreme +40%. Different stages add together (three Hard stages give x1.75). Repeating a boss adds no stage. Tier promotions depend on species and stars; new-spawn health reflects the tier. New Lords defeats count globally even when their mod uses personal progress.\nMONSTRUM ALTARS: Eikthyr reveals Asmodeus, The Elder reveals Svålt, and Bonemass reveals Vrykolathas when that altar is registered in the world. If its registration is missing, the server attempts bounded recovery of one altar with Monstrum's original native placement rules, only in unexplored zones. It then reveals the location. No repeat kill or Upgrade World command is required. Other locations and explored zones are not regenerated. If no valid terrain exists, the log explains the failure; no fake marker is forced.", "tm071_text_69"), new Entry("\n\nCataclysm conserva tier y elemento al domesticar. No-muerto es un estado combinable (Feral No-muerto, Cataclysm No-muerto). Doma de combate: 20% inicial para Cataclysm o No-muerto; 10% al combinar ambos; +5 puntos por nivel adicional hasta 100%. Requisitos adicionales antes del ajuste de dificultad: +5 / +8 / +13 niveles; atributos +10% / +15% / +25%. La comida no evita esta doma especial. Solo Cataclysm y No-muerto reciben una reducción especial suave al domesticar; los demás tiers conservan su balance normal; no se pierden estrellas, inventario ni puntos de compañero.\nCataclysm domesticado: x2.40 vida, x1.92 daño, 28% reducción y x1.20 velocidad por tier. No-muerto domesticado: x1.35 vida, x1.25 daño, +8 puntos de reducción y x1.06 velocidad sobre su tier. Robo de vida máximo 10%; veneno y frío recibidos se reducen 75%, sin inmunidad total. Los valores se combinan y se añaden a la progresión normal.\nCon SeasonalSLSBridge activo, las domas conservan la apariencia de sus atributos guardados de StarLevelSystem. El tinte corporal No-muerto respeta esa skin; sus ojos se conservan. La apariencia no restaura estadísticas salvajes.", "\n\nCataclysm conserva tier y elemento al domesticar. No-muerto es un estado combinable (Feral No-muerto, Cataclysm No-muerto). Doma de combate: 20% inicial para Cataclysm o No-muerto; 10% al combinar ambos; +5 puntos por nivel adicional hasta 100%. Requisitos adicionales antes del ajuste de dificultad: +5 / +8 / +13 niveles; atributos +10% / +15% / +25%. La comida no evita esta doma especial. Solo Cataclysm y No-muerto reciben una reducción especial suave al domesticar; los demás tiers conservan su balance normal; no se pierden estrellas, inventario ni puntos de compañero.\nCataclysm domesticado: x2.40 vida, x1.92 daño, 28% reducción y x1.20 velocidad por tier. No-muerto domesticado: x1.35 vida, x1.25 daño, +8 puntos de reducción y x1.06 velocidad sobre su tier. Robo de vida máximo 10%; veneno y frío recibidos se reducen 75%, sin inmunidad total. Los valores se combinan y se añaden a la progresión normal.\nCon SeasonalSLSBridge activo, las domas conservan la apariencia de sus atributos guardados de StarLevelSystem. El tinte corporal No-muerto respeta esa skin; sus ojos se conservan. La apariencia no restaura estadísticas salvajes.", "\n\nCataclysm keeps its tier and element when tamed. Undead is a combinable state (Feral Undead, Cataclysm Undead). Combat-taming starting chances: Cataclysm or Undead 20%; both combined 10%; +5 percentage points per extra level up to 100%. Extra requirements before difficulty scaling: +5/+8/+13 levels and +10%/+15%/+25% attributes. Food does not bypass this special taming. Only Cataclysm and Undead receive the special gentle reduction when tamed; other tiers keep normal balance. Stars, inventory and companion points are retained.\nTamed Cataclysm: x2.40 health, x1.92 damage, 28% reduction and x1.20 tier speed. Tamed Undead: x1.35 health, x1.25 damage, +8 percentage points reduction and x1.06 speed over its tier. Life steal is capped at 10%; poison/frost damage taken is reduced by 75%, without complete immunity. These combine with normal progression.\nWith SeasonalSLSBridge active, tames keep their stored StarLevelSystem attribute appearance. The Undead body tint respects that skin and retains the eyes. Visual preservation does not restore wild statistics.", "tm071_text_70"), new Entry("\n\nLa pasiva se aplica automáticamente bajo sus condiciones. Abre F11 → Pasivas de jefes para ver tu estado, los siguientes rangos y sus costes.", "\n\nLa pasiva se aplica automáticamente bajo sus condiciones. Abre F11 → Pasivas de jefes para ver tu estado, los siguientes rangos y sus costes.", "\n\nThis passive applies automatically when its conditions are met. Open F11 → Boss passives for your status, next ranks and costs.", "tm071_text_71"), new Entry("\n[<color=#FFE082>Mayús + E</color>] Alforjas", "\n[<color=#FFE082>Mayús + E</color>] Alforjas", "\n[<color=#FFE082>Shift + E</color>] Saddlebags", "tm071_text_72"), new Entry("\n[E] Recoger", "\n[E] Recoger", "\n[E] Pick up", "tm071_text_74"), new Entry("\n<color=#00FFAA>[E] Dar Ectoplasma Macabro (Velo Espectral 10m)</color>", "\n<color=#00FFAA>[E] Dar Ectoplasma Macabro (Velo Espectral 10m)</color>", "\n<color=#00FFAA>[E] Give Macabre Ectoplasm (Spectral Veil 10m)</color>", "tm071_text_75"), new Entry("\n<color=#00FFAA>\ud83d\udc7b Velo Espectral activo (+35% Evasión de Daño)</color>", "\n<color=#00FFAA>\ud83d\udc7b Velo Espectral activo (+35% Evasión de Daño)</color>", "\n<color=#00FFAA>\ud83d\udc7b Spectral Veil active (+35% damage evasion)</color>", "tm071_text_76"), new Entry("\n<color=#00FFFF>[E] Despertar a Jörmungandr (Ofrendar 2x Trofeo de Serpiente Marina - Llevas {0})</color>", "\n<color=#00FFFF>[E] Despertar a Jörmungandr (Ofrendar 2x Trofeo de Serpiente Marina - Llevas {0})</color>", "\n<color=#00FFFF>[E] Awaken Jörmungandr (Offer 2x Serpent Trophy - Carrying {0})</color>", "tm071_text_77"), new Entry("\n<color=#55FF88>[E] Consumir Elixir de Nigromancia para añadir el estado No-muerto conservando el tier</color>", "\n<color=#55FF88>[E] Consumir Elixir de Nigromancia para añadir el estado No-muerto conservando el tier</color>", "\n<color=#55FF88>[E] Consume a Necromancy Elixir to add Undead while keeping the tier</color>", "tm071_text_78"), new Entry("\n<color=#55FF88>⚔\ufe0f [DOMA POR COMBATE AUTORIZADA]</color>\n<color=#CCCCCC>(Portas su Trofeo · Debilítalo al umbral de vida del preset para someterlo)</color>", "\n<color=#55FF88>⚔\ufe0f [DOMA POR COMBATE AUTORIZADA]</color>\n<color=#CCCCCC>(Portas su Trofeo · Debilítalo al umbral de vida del preset para someterlo)</color>", "\n<color=#55FF88>⚔\ufe0f [COMBAT TAMING AUTHORIZED]</color>\n<color=#CCCCCC>(You carry its trophy · Weaken it to your preset's health threshold)</color>", "tm071_text_79"), new Entry("\n<color=#888888>\ud83d\udc41\ufe0f Bestiario: [Requiere Inteligencia Nv. 5 para analizar dieta]</color>", "\n<color=#888888>\ud83d\udc41\ufe0f Bestiario: [Requiere Inteligencia Nv. 5 para analizar dieta]</color>", "\n<color=#888888>\ud83d\udc41\ufe0f Bestiary: [Requires Intellect Lv. 5 to analyze diet]</color>", "tm071_text_82"), new Entry("\n<color=#88DDFF>\ud83c\udf3e [DOMA PACÍFICA CON COMIDA]</color>\n<color=#CCCCCC>(Aliméntalo en corral/suelo o noquéalo a puño limpio)</color>", "\n<color=#88DDFF>\ud83c\udf3e [DOMA PACÍFICA CON COMIDA]</color>\n<color=#CCCCCC>(Aliméntalo en corral/suelo o noquéalo a puño limpio)</color>", "\n<color=#88DDFF>\ud83c\udf3e [PEACEFUL FOOD TAMING]</color>\n<color=#CCCCCC>(Feed it in a pen/on the ground, or subdue it bare-handed)</color>", "tm071_text_83"), new Entry("\n<color=#A0E0FF>\ud83d\udcd6 Dieta:</color> ", "\n<color=#A0E0FF>\ud83d\udcd6 Dieta:</color> ", "\n<color=#A0E0FF>\ud83d\udcd6 Diet:</color> ", "tm071_text_84"), new Entry("\n<color=#A0FFA0>[1-8 con Arma/Armadura] Equipar a este humanoide</color>\n<color=#80D8FF>[Shift + E] Alforjas (auto-equipa armadura por nivel)</color>", "\n<color=#A0FFA0>[1-8 con Arma/Armadura] Equipar a este humanoide</color>\n<color=#80D8FF>[Shift + E] Alforjas (auto-equipa armadura por nivel)</color>", "\n<color=#A0FFA0>[1-8 with weapon/armor] Equip this humanoid</color>\n<color=#80D8FF>[Shift + E] Saddlebags (auto-equip armor by level)</color>", "tm071_text_85"), new Entry("\n<color=#A0FFA0>[1-8 con Arma/Armadura] Equipar</color> · <color=#FFE082>[Alt + E] Desequipar todo</color>", "\n<color=#A0FFA0>[1-8 con Arma/Armadura] Equipar</color> · <color=#FFE082>[Alt + E] Desequipar todo</color>", "\n<color=#A0FFA0>[1-8 with weapon/armor] Equip</color> · <color=#FFE082>[Alt + E] Unequip all</color>", "tm071_text_86"), new Entry("\n<color=#A0FFA0>[F8] o 'tm readiness' para ver recomendaciones.</color>", "\n<color=#A0FFA0>[F8] o 'tm readiness' para ver recomendaciones.</color>", "\n<color=#A0FFA0>[F8] or 'tm readiness' for recommendations.</color>", "tm071_text_87"), new Entry("\n<color=#A0FFA0>⏳ Progreso:</color> {0}% (~{1} min) · Estado: {2}", "\n<color=#A0FFA0>⏳ Progreso:</color> {0}% (~{1} min) · Estado: {2}", "\n<color=#A0FFA0>⏳ Progress:</color> {0}% (~{1} min) · Status: {2}", "tm071_text_88"), new Entry("\n<color=#A0FFA0>Usa consola 'tm readiness' para ver el informe completo.</color>", "\n<color=#A0FFA0>Usa consola 'tm readiness' para ver el informe completo.</color>", "\n<color=#A0FFA0>Use 'tm readiness' in the console for the full report.</color>", "tm071_text_89"), new Entry("\n<color=#C8A2C8>Vínculo MMO:</color> Jugador Nv. ", "\n<color=#C8A2C8>Vínculo MMO:</color> Jugador Nv. ", "\n<color=#C8A2C8>MMO bond:</color> Player Lv. ", "tm071_text_90"), new Entry("\n<color=#FF3300>[E] Consumir Elixir Cataclísmico para mutar a Elemental</color>", "\n<color=#FF3300>[E] Consumir Elixir Cataclísmico para mutar a Elemental</color>", "\n<color=#FF3300>[E] Consume a Cataclysmic Elixir for an elemental mutation</color>", "tm071_text_91"), new Entry("\n<color=#FF5555>\ud83d\udd12 [DOMA BLOQUEADA]</color> <color=#FFDD88>", "\n<color=#FF5555>\ud83d\udd12 [DOMA BLOQUEADA]</color> <color=#FFDD88>", "\n<color=#FF5555>\ud83d\udd12 [TAMING LOCKED]</color> <color=#FFDD88>", "tm071_text_92"), new Entry("\n<color=#FF7700>[E] Dar Tuétano de Ultratumba (Furia Necrótica 10m)</color>", "\n<color=#FF7700>[E] Dar Tuétano de Ultratumba (Furia Necrótica 10m)</color>", "\n<color=#FF7700>[E] Give Underworld Marrow (Necrotic Fury 10m)</color>", "tm071_text_93"), new Entry("\n<color=#FF7700>\ud83d\udd25 Furia Necrótica activa (+25% Daño y Toque Venenoso)</color>", "\n<color=#FF7700>\ud83d\udd25 Furia Necrótica activa (+25% Daño y Toque Venenoso)</color>", "\n<color=#FF7700>\ud83d\udd25 Necrotic Fury active (+25% damage and poisonous touch)</color>", "tm071_text_94"), new Entry("\n<color=#FF8800>[E] Consumir Elixir de Ascensión Apex para evolucionar</color>", "\n<color=#FF8800>[E] Consumir Elixir de Ascensión Apex para evolucionar</color>", "\n<color=#FF8800>[E] Consume an Apex Ascension Elixir to evolve</color>", "tm071_text_95"), new Entry("\n<color=#FFCC00>⚔\ufe0f [REQUIERE PORTAR SU TROFEO]</color>\n<color=#CCCCCC>(Lleva su Trofeo en inventario y debilítalo al umbral del preset para someterlo)</color>", "\n<color=#FFCC00>⚔\ufe0f [REQUIERE PORTAR SU TROFEO]</color>\n<color=#CCCCCC>(Lleva su Trofeo en inventario y debilítalo al umbral del preset para someterlo)</color>", "\n<color=#FFCC00>⚔\ufe0f [REQUIRES ITS TROPHY]</color>\n<color=#CCCCCC>(Carry its trophy and weaken it to the preset's threshold)</color>", "tm071_text_96"), new Entry("\n<color=#FFD700>[E] Consumir Elixir de Ascensión Alpha para evolucionar</color>", "\n<color=#FFD700>[E] Consumir Elixir de Ascensión Alpha para evolucionar</color>", "\n<color=#FFD700>[E] Consume an Alpha Ascension Elixir to evolve</color>", "tm071_text_97"), new Entry("\n<color=#FFD700>[E] Ofrendar Trofeo de Jefe para consagrar Rango {0}/3 (Requiere {1}x {2} - Llevas {3})</color>", "\n<color=#FFD700>[E] Ofrendar Trofeo de Jefe para consagrar Rango {0}/3 (Requiere {1}x {2} - Llevas {3})</color>", "\n<color=#FFD700>[E] Offer a boss trophy to consecrate Rank {0}/3 (Requires {1}x {2} - Carrying {3})</color>", "tm071_text_98"), new Entry("\n<color=#FFD700>[Shift + E] Consagrar {0} (Rango {1}/3 - Requiere {2}x {3} - Llevas {4})</color>", "\n<color=#FFD700>[Shift + E] Consagrar {0} (Rango {1}/3 - Requiere {2}x {3} - Llevas {4})</color>", "\n<color=#FFD700>[Shift + E] Consecrate {0} (Rank {1}/3 - Requires {2}x {3} - Carrying {4})</color>", "tm071_text_99"), new Entry("\n<color=#FFD700>\ud83d\udc51 Análisis Maestro:</color> ~{0} raciones para completar", "\n<color=#FFD700>\ud83d\udc51 Análisis Maestro:</color> ~{0} raciones para completar", "\n<color=#FFD700>\ud83d\udc51 Master analysis:</color> ~{0} portions to complete", "tm071_text_100"), new Entry("\n<color={0}>[TameMate] Preparación para {1}: {2}% ({3})</color>", "\n<color={0}>[TameMate] Preparación para {1}: {2}% ({3})</color>", "\n<color={0}>[TameMate] Readiness for {1}: {2}% ({3})</color>", "tm071_text_101"), new Entry("\n<size=11><color=#B0BEC5>Ratón / Flechas: elegir · Enter / Clic Der: confirmar\nU / Esc: cerrar</color></size>", "\n<size=11><color=#B0BEC5>Ratón / Flechas: elegir · Enter / Clic Der: confirmar\nU / Esc: cerrar</color></size>", "\n<size=11><color=#B0BEC5>Mouse / Arrows: select · Enter / Right-click: confirm\nU / Esc: close</color></size>", "tm071_text_102"), new Entry("\nAtributos: Salud +", "\nAtributos: Salud +", "\nAttributes: Health +", "tm071_text_103"), new Entry("\nConsulta tu rango y las condiciones en F11 → 7. Pasivas de jefes. Conserva trofeos adicionales para consagrar los rangos siguientes.", "\nConsulta tu rango y las condiciones en F11 → 7. Pasivas de jefes. Conserva trofeos adicionales para consagrar los rangos siguientes.", "\nCheck your rank and conditions in F11 → 7. Boss passives. Keep extra trophies to consecrate higher ranks.", "tm071_text_104"), new Entry("\nDefensa +", "\nDefensa +", "\nDefense +", "tm071_text_105"), new Entry("\nEquipamiento: ", "\nEquipamiento: ", "\nEquipment: ", "tm071_text_106"), new Entry("\nRecuperándose: ", "\nRecuperándose: ", "\nRecovering: ", "tm071_text_107"), new Entry("\nSalud ", "\nSalud ", "\nHealth ", "tm071_text_108"), new Entry("% daño de combate. No aumenta la velocidad del barco.", "% daño de combate. No aumenta la velocidad del barco.", "% combat damage. Does not increase ship speed.", "tm071_text_109"), new Entry("% de éxito).\nFuria: +", "% de éxito).\nFuria: +", "% success chance).\nFury: +", "tm071_text_110"), new Entry("% gasto de aguante al nadar | +", "% gasto de aguante al nadar | +", "% swimming stamina cost | +", "tm071_text_111"), new Entry("% velocidad del personaje en agua o sobre un barco | +", "% velocidad del personaje en agua o sobre un barco | +", "% character speed in water or aboard a ship | +", "tm071_text_112"), new Entry("% vida y daño. Nuevo intento en 30 s.", "% vida y daño. Nuevo intento en 30 s.", "% health and damage. Retry in 30 s.", "tm071_text_113"), new Entry("%, velocidad x", "%, velocidad x", "%, speed x", "tm071_text_114"), new Entry("). Uso: tm difficulty <facil|normal|dificil|supreme>", "). Uso: tm difficulty <facil|normal|dificil|supreme>", "). Usage: tm difficulty <facil|normal|dificil|supreme>", "tm071_text_115"), new Entry(", daño x", ", daño x", ", damage x", "tm071_text_117"), new Entry(", reducción ", ", reducción ", ", reduction ", "tm071_text_118"), new Entry(". El anfitrión controla la dificultad global.", ". El anfitrión controla la dificultad global.", ". The host controls global difficulty.", "tm071_text_119"), new Entry("'. Escribe /pactos para ver la lista.</color>", "'. Escribe /pactos para ver la lista.</color>", "'. Type /pactos to see the list.</color>", "tm071_text_120"), new Entry(". Estás capacitado para avanzar a: ", ". Estás capacitado para avanzar a: ", ". You are ready to advance to: ", "tm071_text_121"), new Entry(". Se respetan bioma y zonas protegidas.", ". Se respetan bioma y zonas protegidas.", ". Biomes and protected areas are respected.", "tm071_text_128"), new Entry(": ¡Trofeo activo! Debilítalo al umbral de salud del preset.", ": ¡Trofeo activo! Debilítalo al umbral de salud del preset.", ": Trophy ready! Weaken it to the preset's health threshold.", "tm071_text_131"), new Entry(": Doma Bloqueada\n", ": Doma Bloqueada\n", ": Taming locked\n", "tm071_text_132"), new Entry(": Doma con comida o noquéalo a puño limpio.", ": Doma con comida o noquéalo a puño limpio.", ": Tame with food or subdue it bare-handed.", "tm071_text_133"), new Entry(": Falta su Trofeo en tu mochila para someterlo.", ": Falta su Trofeo en tu mochila para someterlo.", ": Carry its trophy in your inventory to subdue it.", "tm071_text_134"), new Entry(": Maestría Suprema Consagrada (Rango 3/3)</color>", ": Maestría Suprema Consagrada (Rango 3/3)</color>", ": Supreme Mastery Consecrated (Rank 3/3)</color>", "tm071_text_135"), new Entry(": no tiene puntos disponibles", ": no tiene puntos disponibles", ": no points available", "tm071_text_136"), new Entry(": vida x", ": vida x", ": health x", "tm071_text_138"), new Entry("; enemigo x", "; enemigo x", "; enemy x", "tm071_text_139"), new Entry("; sin consumo de objetos; cuerno conservado.", "; sin consumo de objetos; cuerno conservado.", "; no extra items consumed; horn retained.", "tm071_text_143"), new Entry("; XP MMO x", "; XP MMO x", "; MMO XP x", "tm071_text_144"), new Entry("-{0}% daño de rayo | +{1} daño de rayo adicional en ataques", "-{0}% daño de rayo | +{1} daño de rayo adicional en ataques", "-{0}% lightning damage taken | +{1}