using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using ComfyLib; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Enhuddlement")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Enhuddlement")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("76613fb2-45a2-4253-b205-58d12f10984e")] [assembly: AssemblyFileVersion("1.2.1")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.1.0")] [module: UnverifiableCode] namespace UnityEngine.UI { public class VerticalGradient : BaseMeshEffect { public enum Blend { Override, Add, Multiply } private readonly List _vertices = new List(); [field: SerializeField] public Gradient EffectGradient { get; set; } = CreateTwoColorGradient(Color.gray, Color.white); [field: SerializeField] public Blend BlendMode { get; set; } = Blend.Multiply; [field: SerializeField] [field: Range(-1f, 1f)] public float EffectOffset { get; set; } public void SetEffectGradient(Color startcolor, Color endColor) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) EffectGradient = CreateTwoColorGradient(startcolor, endColor); } private static Gradient CreateTwoColorGradient(Color startColor, Color endColor) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) Gradient val = new Gradient(); val.colorKeys = (GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(startColor, 0f), new GradientColorKey(endColor, 1f) }; return val; } public override void ModifyMesh(VertexHelper helper) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) if (!((UIBehaviour)this).IsActive() || helper.currentVertCount == 0) { return; } _vertices.Clear(); helper.GetUIVertexStream(_vertices); float y = _vertices[0].position.y; float num = y; float num2 = y; for (int num3 = _vertices.Count - 1; num3 > 0; num3--) { y = _vertices[num3].position.y; if (y > num) { num = y; } else if (y < num2) { num2 = y; } } float num4 = 1f / (num - num2); int i = 0; for (int count = _vertices.Count; i < count; i++) { UIVertex val = _vertices[i]; val.color = Color32.op_Implicit(BlendColor(Color32.op_Implicit(val.color), EffectGradient.Evaluate((val.position.y - num2) * num4 - EffectOffset))); _vertices[i] = val; } helper.Clear(); helper.AddUIVertexTriangleStream(_vertices); } private Color BlendColor(Color firstColor, Color secondColor) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) return (Color)(BlendMode switch { Blend.Add => firstColor + secondColor, Blend.Multiply => firstColor * secondColor, _ => secondColor, }); } } } namespace ComfyLib { public static class ConfigFileExtensions { internal sealed class ConfigurationManagerAttributes { public Action CustomDrawer; public int? Order; } private static readonly Dictionary _sectionToSettingOrder = new Dictionary(); private static int GetSettingOrder(string section) { if (!_sectionToSettingOrder.TryGetValue(section, out var value)) { value = 0; } _sectionToSettingOrder[section] = value - 1; return value; } public static ConfigEntry BindInOrder(this ConfigFile config, string section, string key, T defaultValue, string description) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown return config.Bind(section, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = GetSettingOrder(section) } })); } public static ConfigEntry BindInOrder(this ConfigFile config, string section, string key, T defaultValue, string description, Action customDrawer) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown return config.Bind(section, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { CustomDrawer = customDrawer, Order = GetSettingOrder(section) } })); } public static ConfigEntry BindInOrder(this ConfigFile config, string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown return config.Bind(section, key, defaultValue, new ConfigDescription(description, acceptableValues, new object[1] { new ConfigurationManagerAttributes { Order = GetSettingOrder(section) } })); } } public static class CanvasGroupExtensions { public static CanvasGroup SetAlpha(this CanvasGroup canvasGroup, float alpha) { canvasGroup.alpha = alpha; return canvasGroup; } public static CanvasGroup SetBlocksRaycasts(this CanvasGroup canvasGroup, bool blocksRaycasts) { canvasGroup.blocksRaycasts = blocksRaycasts; return canvasGroup; } } public static class ComponentExtensions { public static T SetName(this T component, string name) where T : Component { ((Object)((Component)component).gameObject).name = name; return component; } } public static class OutlineExtensions { public static Outline SetEffectColor(this Outline outline, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ((Shadow)outline).effectColor = color; return outline; } } public static class RectTransformExtensions { public static RectTransform SetAnchorMin(this RectTransform rectTransform, Vector2 anchorMin) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rectTransform.anchorMin = anchorMin; return rectTransform; } public static RectTransform SetAnchorMax(this RectTransform rectTransform, Vector2 anchorMax) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rectTransform.anchorMax = anchorMax; return rectTransform; } public static RectTransform SetPivot(this RectTransform rectTransform, Vector2 pivot) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rectTransform.pivot = pivot; return rectTransform; } public static RectTransform SetPosition(this RectTransform rectTransform, Vector2 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rectTransform.anchoredPosition = position; return rectTransform; } public static RectTransform SetSizeDelta(this RectTransform rectTransform, Vector2 sizeDelta) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rectTransform.sizeDelta = sizeDelta; return rectTransform; } } public static class TextMeshProUGUIExtensions { public static T SetAlignment(this T tmpText, TextAlignmentOptions alignment) where T : TMP_Text { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)tmpText).alignment = alignment; return tmpText; } public static T SetColor(this T tmpText, Color color) where T : TMP_Text { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Graphic)(object)tmpText).color = color; return tmpText; } public static T SetEnableAutoSizing(this T tmpText, bool enableAutoSizing) where T : TMP_Text { ((TMP_Text)tmpText).enableAutoSizing = enableAutoSizing; return tmpText; } public static T SetFont(this T tmpText, TMP_FontAsset font) where T : TMP_Text { ((TMP_Text)tmpText).font = font; return tmpText; } public static T SetFontSize(this T tmpText, float fontSize) where T : TMP_Text { ((TMP_Text)tmpText).fontSize = fontSize; return tmpText; } public static T SetFontMaterial(this T tmpText, Material fontMaterial) where T : TMP_Text { ((TMP_Text)tmpText).fontMaterial = fontMaterial; return tmpText; } public static T SetMargin(this T tmpText, Vector4 margin) where T : TMP_Text { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)tmpText).margin = margin; return tmpText; } public static T SetOverflowMode(this T tmpText, TextOverflowModes overflowMode) where T : TMP_Text { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)tmpText).overflowMode = overflowMode; return tmpText; } public static T SetRichText(this T tmpText, bool richText) where T : TMP_Text { ((TMP_Text)tmpText).richText = richText; return tmpText; } public static T SetTextWrappingMode(this T tmpText, TextWrappingModes textWrappingMode) where T : TMP_Text { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)tmpText).textWrappingMode = textWrappingMode; return tmpText; } } } namespace Enhuddlement { public static class EnemyHudUpdater { private static readonly List _keysToRemove = new List(12); public static void UpdateHuds(ref EnemyHud enemyHud, ref Player player, ref Sadle sadle, float dt, ConditionalWeakTable healthTextCache) { //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) Camera mainCamera = Utils.GetMainCamera(); if (!Object.op_Implicit((Object)(object)mainCamera)) { return; } Sadle obj = sadle.Ref(); Character val = ((obj != null) ? obj.GetCharacter() : null); Player obj2 = player.Ref(); Character val2 = ((obj2 != null) ? obj2.GetHoverCreature() : null); _keysToRemove.Clear(); foreach (KeyValuePair hud in enemyHud.m_huds) { HudData value = hud.Value; Character character = value.m_character; if (!Object.op_Implicit((Object)(object)character) || !enemyHud.TestShow(character, true) || (Object)(object)character == (Object)(object)val) { _keysToRemove.Add(character); Object.Destroy((Object)(object)value.m_gui); continue; } if ((Object)(object)character == (Object)(object)val2) { value.m_hoverTimer = 0f; } value.m_hoverTimer += dt; if (character.IsPlayer() || character.IsBoss() || value.m_isMount || value.m_hoverTimer < enemyHud.m_hoverShowDuration) { value.m_gui.SetActive(true); ((TMP_Text)value.m_name).text = Localization.m_instance.Localize(character.GetHoverName()); if (character.IsPlayer()) { value.m_name.SetColor(character.IsPVPEnabled() ? PluginConfig.PlayerHudNameTextPvPColor.Value : PluginConfig.PlayerHudNameTextColor.Value); } else if (Object.op_Implicit((Object)(object)character.m_baseAI) && !character.IsBoss()) { bool flag = character.m_baseAI.HaveTarget(); bool flag2 = character.m_baseAI.IsAlerted(); if (PluginConfig.EnemyHudUseNameForStatus.Value) { value.m_name.SetColor((!(flag || flag2)) ? PluginConfig.EnemyHudHealthTextColor.Value : (flag2 ? PluginConfig.EnemyHudNameTextAlertedColor.Value : PluginConfig.EnemyHudNameTextAwareColor.Value)); } else { ((Component)value.m_alerted).gameObject.SetActive(flag2); ((Component)value.m_aware).gameObject.SetActive(flag && !flag2); } } } else { value.m_gui.SetActive(false); } float health = character.GetHealth(); float maxHealth = character.GetMaxHealth(); float value2 = health / maxHealth; if (PluginConfig.ShowEnemyHealthValue.Value && healthTextCache.TryGetValue(value, out var value3)) { ((TMP_Text)value3).SetText($"{health:N0} / {maxHealth:N0}"); } value.m_healthSlow.SetValue(value2); value.m_healthFast.SetValue(value2); if (Object.op_Implicit((Object)(object)value.m_healthFastFriendly)) { value.m_healthFast.SetColor(character.IsTamed() ? PluginConfig.EnemyHudHealthBarTamedColor.Value : ((Object.op_Implicit((Object)(object)player) && !BaseAI.IsEnemy((Character)(object)player, character)) ? PluginConfig.EnemyHudHealthBarFriendlyColor.Value : PluginConfig.EnemyHudHealthBarColor.Value)); } if (value.m_isMount && Object.op_Implicit((Object)(object)sadle)) { float stamina = sadle.GetStamina(); float maxStamina = sadle.GetMaxStamina(); value.m_stamina.SetValue(stamina / maxStamina); ((TMP_Text)value.m_healthText).text = $"{health:N0}"; ((TMP_Text)value.m_staminaText).text = $"{stamina:N0}"; } if (value.m_gui.activeSelf && (PluginConfig.FloatingBossHud.Value || !character.IsBoss())) { Vector3 val3 = (character.IsPlayer() ? (character.GetHeadPoint() + PluginConfig.PlayerHudPositionOffset.Value) : (character.IsBoss() ? (character.GetTopPoint() + PluginConfig.BossHudPositionOffset.Value) : ((!value.m_isMount || !Object.op_Implicit((Object)(object)player)) ? (character.GetTopPoint() + PluginConfig.EnemyHudPositionOffset.Value) : (((Component)((Component)player).transform).transform.position - ((Component)player).transform.up * 0.5f)))); Vector3 val4 = mainCamera.WorldToScreenPoint(val3); if (val4.x < 0f || val4.x > (float)Screen.width || val4.y < 0f || val4.y > (float)Screen.height || val4.z > 0f) { value.m_gui.transform.position = val4; value.m_gui.SetActive(true); } else { value.m_gui.SetActive(false); } } } for (int i = 0; i < _keysToRemove.Count; i++) { enemyHud.m_huds.Remove(_keysToRemove[i]); } _keysToRemove.Clear(); } } [BepInPlugin("redseiko.valheim.enhuddlement", "Enhuddlement", "1.2.1")] public class Enhuddlement : BaseUnityPlugin { public const string PluginGuid = "redseiko.valheim.enhuddlement"; public const string PluginName = "Enhuddlement"; public const string PluginVersion = "1.2.1"; public static Harmony HarmonyInstance { get; private set; } private void Awake() { PluginConfig.BindConfig(((BaseUnityPlugin)this).Config); HarmonyInstance = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "redseiko.valheim.enhuddlement"); } private void OnDestroy() { Harmony harmonyInstance = HarmonyInstance; if (harmonyInstance != null) { harmonyInstance.UnpatchSelf(); } } } [HarmonyPatch(typeof(EnemyHud))] internal static class EnemyHudPatch { private static readonly ConditionalWeakTable _healthTextCache = new ConditionalWeakTable(); [HarmonyPrefix] [HarmonyPatch("ShowHud")] private static void ShowHudPrefix(ref EnemyHud __instance, ref Character c, ref bool __state) { __state = __instance.m_huds.ContainsKey(c); } [HarmonyPostfix] [HarmonyPatch("ShowHud")] private static void ShowHudPostfix(ref EnemyHud __instance, ref Character c, ref bool isMount, ref bool __state) { if (!(!PluginConfig.IsModEnabled.Value | __state) && __instance.m_huds.TryGetValue(c, out var value)) { if (c.IsPlayer()) { SetupPlayerHud(value); } else if (c.IsBoss()) { SetupBossHud(value); } else if (!isMount) { SetupEnemyHud(value); } } } private static void SetupPlayerHud(HudData hudData) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) SetupName(hudData, PluginConfig.PlayerHudNameTextFontSize.Value, PluginConfig.PlayerHudNameTextColor.Value); SetupHud(hudData, PluginConfig.PlayerHudHealthTextFontSize.Value, PluginConfig.PlayerHudHealthTextColor.Value, PluginConfig.PlayerHudHealthBarWidth.Value, PluginConfig.PlayerHudHealthBarHeight.Value); hudData.m_healthFast.SetColor(PluginConfig.PlayerHudHealthBarColor.Value); } private static void SetupBossHud(HudData hudData) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) SetupName(hudData, PluginConfig.BossHudNameTextFontSize.Value, PluginConfig.BossHudNameTextColor.Value); SetupHud(hudData, PluginConfig.BossHudHealthTextFontSize.Value, PluginConfig.BossHudHealthTextFontColor.Value, PluginConfig.BossHudHealthBarWidth.Value, PluginConfig.BossHudHealthBarHeight.Value); hudData.m_healthFast.SetColor(PluginConfig.BossHudHealthBarColor.Value); } private static void SetupEnemyHud(HudData hudData) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) SetupName(hudData, PluginConfig.EnemyHudNameTextFontSize.Value, PluginConfig.EnemyHudNameTextColor.Value); SetupHud(hudData, PluginConfig.EnemyHudHealthTextFontSize.Value, PluginConfig.EnemyHudHealthTextColor.Value, PluginConfig.EnemyHudHealthBarWidth.Value, PluginConfig.EnemyHudHealthBarHeight.Value); SetupAlerted(hudData); SetupAware(hudData); hudData.m_healthFast.SetColor(PluginConfig.EnemyHudHealthBarColor.Value); } private static void SetupName(HudData hudData, int nameTextFontSize, Color nameTextColor) { //IL_0006: 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_0059: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) hudData.m_name.SetColor(nameTextColor).SetFontSize((float)nameTextFontSize).SetTextWrappingMode((TextWrappingModes)0) .SetOverflowMode((TextOverflowModes)0) .SetAlignment((TextAlignmentOptions)1026) .SetEnableAutoSizing(enableAutoSizing: false); ((Component)hudData.m_name).GetComponent().SetAnchorMin(new Vector2(0.5f, 0.5f)).SetAnchorMax(new Vector2(0.5f, 0.5f)) .SetPivot(new Vector2(0.5f, 0f)) .SetPosition(new Vector2(0f, 8f)) .SetSizeDelta(new Vector2(((TMP_Text)hudData.m_name).preferredWidth, ((TMP_Text)hudData.m_name).preferredHeight)); } private static void SetupHud(HudData hudData, int healthTextFontSize, Color healthTextFontColor, float healthBarWidth, float healthBarHeight) { //IL_0026: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) Transform val = hudData.m_gui.transform.Find("Health"); ((Component)val).GetComponent().SetAnchorMin(new Vector2(0.5f, 0.5f)).SetAnchorMax(new Vector2(0.5f, 0.5f)) .SetPivot(new Vector2(0.5f, 1f)) .SetPosition(Vector2.zero) .SetSizeDelta(new Vector2(healthBarWidth, healthBarHeight)); SetupHealthBars(hudData, healthBarWidth, healthBarHeight); TextMeshProUGUI value = CreateHealthText(hudData, val, healthTextFontSize, healthTextFontColor); _healthTextCache.Add(hudData, value); SetupLevel(hudData, val); } private static void SetupHealthBars(HudData hudData, float healthBarWidth, float healthBarHeight) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) hudData.m_healthFast.m_width = healthBarWidth; ((Component)hudData.m_healthFast).GetComponent().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one) .SetPivot(Vector2.zero) .SetPosition(Vector2.zero) .SetSizeDelta(Vector2.zero); hudData.m_healthFast.m_bar.SetAnchorMin(new Vector2(0f, 0.5f)).SetAnchorMax(new Vector2(0f, 0.5f)).SetPivot(new Vector2(0f, 0.5f)) .SetPosition(Vector2.zero) .SetSizeDelta(new Vector2(healthBarWidth, healthBarHeight)); ((Component)hudData.m_healthFast).gameObject.SetActive(true); hudData.m_healthSlow.m_width = healthBarWidth; ((Component)hudData.m_healthSlow).GetComponent().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one) .SetPivot(Vector2.zero) .SetPosition(Vector2.zero) .SetSizeDelta(Vector2.zero); hudData.m_healthSlow.m_bar.SetAnchorMin(new Vector2(0f, 0.5f)).SetAnchorMax(new Vector2(0f, 0.5f)).SetPivot(new Vector2(0f, 0.5f)) .SetPosition(Vector2.zero) .SetSizeDelta(new Vector2(healthBarWidth, healthBarHeight)); ((Component)hudData.m_healthSlow).gameObject.SetActive(true); GuiBar obj = hudData.m_healthFastFriendly.Ref(); if (obj != null) { ((Component)obj).gameObject.SetActive(false); } } private static void SetupLevel(HudData hudData, Transform healthTransform) { if (hudData.m_character.m_level > (hudData.m_character.IsBoss() ? 1 : 3)) { CreateEnemyLevelText(hudData, healthTransform); RectTransform obj = hudData.m_level2.Ref(); if (obj != null) { ((Component)obj).gameObject.SetActive(false); } RectTransform obj2 = hudData.m_level3.Ref(); if (obj2 != null) { ((Component)obj2).gameObject.SetActive(false); } } else { SetupEnemyLevelStars(hudData, healthTransform); } } private static void SetupAlerted(HudData hudData) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)hudData.m_alerted)) { TextMeshProUGUI component = ((Component)hudData.m_alerted).GetComponent(); ((Transform)hudData.m_alerted).SetParent(((TMP_Text)hudData.m_name).transform, false); hudData.m_alerted.SetAnchorMin(new Vector2(0.5f, 1f)).SetAnchorMax(new Vector2(0.5f, 1f)).SetPivot(new Vector2(0.5f, 0f)) .SetPosition(Vector2.zero) .SetSizeDelta(((TMP_Text)component).GetPreferredValues()); ((Component)hudData.m_alerted).gameObject.SetActive(!PluginConfig.EnemyHudUseNameForStatus.Value); } } private static void SetupAware(HudData hudData) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)hudData.m_aware)) { ((Transform)hudData.m_aware).SetParent(((TMP_Text)hudData.m_name).transform, false); hudData.m_aware.SetAnchorMin(new Vector2(0.5f, 1f)).SetAnchorMax(new Vector2(0.5f, 1f)).SetPivot(new Vector2(0.5f, 0f)) .SetPosition(Vector2.zero) .SetSizeDelta(new Vector2(30f, 30f)); ((Component)hudData.m_aware).gameObject.SetActive(!PluginConfig.EnemyHudUseNameForStatus.Value); } } private static TextMeshProUGUI CreateHealthText(HudData hudData, Transform parentTransform, int healthTextFontSize, Color healthTextFontColor) { //IL_0029: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = Object.Instantiate(hudData.m_name); ((TMP_Text)obj).transform.SetParent(parentTransform, false); ((Object)obj).name = "HealthText"; ((Component)obj).GetComponent().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one) .SetPivot(new Vector2(0.5f, 0.5f)) .SetPosition(Vector2.zero); ((TMP_Text)obj).text = string.Empty; ((TMP_Text)obj).fontSize = healthTextFontSize; ((Graphic)obj).color = healthTextFontColor; ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj).enableAutoSizing = false; ((TMP_Text)obj).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)obj).overflowMode = (TextOverflowModes)0; return obj; } private static TextMeshProUGUI CreateEnemyLevelText(HudData hudData, Transform healthTransform) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = Object.Instantiate(hudData.m_name); ((Object)val).name = "LevelText"; ((TMP_Text)val).text = string.Empty; ((TMP_Text)val).fontSize = Mathf.Clamp((float)(int)((TMP_Text)hudData.m_name).fontSize, (float)PluginConfig.EnemyLevelTextMinFontSize.Value, 64f); ((Graphic)val).color = new Color(1f, 0.85882f, 0.23137f, 1f); ((TMP_Text)val).enableAutoSizing = false; ((TMP_Text)val).overflowMode = (TextOverflowModes)0; if (PluginConfig.EnemyLevelShowByName.Value) { ((TMP_Text)val).transform.SetParent(((TMP_Text)hudData.m_name).transform, false); ((Component)val).GetComponent().SetAnchorMin(new Vector2(1f, 0.5f)).SetAnchorMax(new Vector2(1f, 0.5f)) .SetPivot(new Vector2(0f, 0.5f)) .SetPosition(new Vector2(5f, 0f)) .SetSizeDelta(new Vector2(100f, ((TMP_Text)val).GetPreferredValues().y + 5f)); ((TMP_Text)val).alignment = (TextAlignmentOptions)513; ((TMP_Text)val).textWrappingMode = (TextWrappingModes)0; } else { ((TMP_Text)val).transform.SetParent(healthTransform, false); Vector2 sizeDelta = ((Component)healthTransform).GetComponent().sizeDelta; sizeDelta.y = ((TMP_Text)val).GetPreferredValues().y * 2f; ((Component)val).GetComponent().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.zero) .SetPivot(Vector2.zero) .SetPosition(new Vector2(0f, 0f - sizeDelta.y - 2f)) .SetSizeDelta(sizeDelta); ((TMP_Text)val).alignment = (TextAlignmentOptions)257; ((TMP_Text)val).textWrappingMode = (TextWrappingModes)1; } int num = hudData.m_character.m_level - 1; ((TMP_Text)val).SetText((num <= PluginConfig.EnemyLevelStarCutoff.Value) ? string.Concat(Enumerable.Repeat(PluginConfig.EnemyLevelStarSymbol.Value, num)) : $"{num}{PluginConfig.EnemyLevelStarSymbol.Value}"); return val; } private static void SetupEnemyLevelStars(HudData hudData, Transform healthTransform) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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 (Object.op_Implicit((Object)(object)hudData.m_level2)) { if (PluginConfig.EnemyLevelShowByName.Value) { ((Transform)hudData.m_level2).SetParent(((TMP_Text)hudData.m_name).transform); hudData.m_level2.SetAnchorMin(new Vector2(1f, 0.5f)).SetAnchorMax(new Vector2(1f, 0.5f)).SetPivot(new Vector2(0f, 0.5f)) .SetPosition(new Vector2(12f, 0f)) .SetSizeDelta(Vector2.zero); } else { ((Transform)hudData.m_level2).SetParent(healthTransform, false); hudData.m_level2.SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.zero).SetPivot(Vector2.zero) .SetPosition(new Vector2(7.5f, -10f)) .SetSizeDelta(Vector2.zero); } ((Component)hudData.m_level2).gameObject.SetActive(hudData.m_character.GetLevel() == 2); } if (Object.op_Implicit((Object)(object)hudData.m_level3)) { if (PluginConfig.EnemyLevelShowByName.Value) { ((Transform)hudData.m_level3).SetParent(((TMP_Text)hudData.m_name).transform, false); hudData.m_level3.SetAnchorMin(new Vector2(1f, 0.5f)).SetAnchorMax(new Vector2(1f, 0.5f)).SetPivot(new Vector2(0f, 0.5f)) .SetPosition(new Vector2(20f, 0f)) .SetSizeDelta(Vector2.zero); } else { ((Transform)hudData.m_level3).SetParent(healthTransform, false); hudData.m_level3.SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.zero).SetPivot(Vector2.zero) .SetPosition(new Vector2(15.5f, -10f)) .SetSizeDelta(Vector2.zero); } ((Component)hudData.m_level3).gameObject.SetActive(hudData.m_character.GetLevel() == 3); } } [HarmonyPrefix] [HarmonyPatch("UpdateHuds")] private static bool UpdateHudsPrefix(ref EnemyHud __instance, ref Player player, ref Sadle sadle, float dt) { if (PluginConfig.IsModEnabled.Value) { EnemyHudUpdater.UpdateHuds(ref __instance, ref player, ref sadle, dt, _healthTextCache); return false; } return true; } [HarmonyTranspiler] [HarmonyPatch("LateUpdate")] private static IEnumerable LateUpdateTranspiler(IEnumerable instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[4] { new CodeMatch((OpCode?)OpCodes.Stloc_3, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldloc_3, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldloc_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null) }).Advance(3).SetInstructionAndAdvance(Transpilers.EmitDelegate>((Func)CharacterLocalPlayerEqualityDelegate)) .InstructionEnumeration(); } private static bool CharacterLocalPlayerEqualityDelegate(Character character, Player player) { if (PluginConfig.PlayerHudShowLocalPlayer.Value) { return false; } return (Object)(object)character == (Object)(object)player; } [HarmonyPostfix] [HarmonyPatch("TestShow")] private static void TestShowPostfix(ref EnemyHud __instance, ref Character c, ref bool __result) { if (__result && (Object)(object)c == (Object)(object)Player.m_localPlayer) { __result = PluginConfig.IsModEnabled.Value && PluginConfig.PlayerHudShowLocalPlayer.Value; } } } [HarmonyPatch(typeof(FejdStartup))] internal static class FejdStartupPatch { private static readonly HashSet _targetHarmonyIds = new HashSet { "MK_BetterUI" }; [HarmonyPostfix] [HarmonyPatch("Awake")] [HarmonyPriority(0)] private static void AwakePostfix() { UnpatchIfPatched(typeof(EnemyHud)); } private static void UnpatchIfPatched(Type type) { foreach (MethodInfo declaredMethod in AccessTools.GetDeclaredMethods(type)) { Patches patchInfo = Harmony.GetPatchInfo((MethodBase)declaredMethod); if (patchInfo == null) { continue; } foreach (string owner in patchInfo.Owners) { if (_targetHarmonyIds.Contains(owner)) { ZLog.Log((object)("Unpatching all '" + owner + "' patches on " + type.FullName + "." + declaredMethod.Name)); Harmony harmonyInstance = Enhuddlement.HarmonyInstance; if (harmonyInstance != null) { harmonyInstance.Unpatch((MethodBase)declaredMethod, (HarmonyPatchType)0, owner); } } } } } } public static class PluginConfig { public static ConfigEntry IsModEnabled { get; private set; } public static ConfigEntry ShowEnemyHealthValue { get; private set; } public static ConfigEntry PlayerHudShowLocalPlayer { get; private set; } public static ConfigEntry PlayerHudPositionOffset { get; private set; } public static ConfigEntry PlayerHudNameTextFontSize { get; private set; } public static ConfigEntry PlayerHudNameTextColor { get; private set; } public static ConfigEntry PlayerHudNameTextPvPColor { get; private set; } public static ConfigEntry PlayerHudHealthTextFontSize { get; private set; } public static ConfigEntry PlayerHudHealthTextColor { get; private set; } public static ConfigEntry PlayerHudHealthBarWidth { get; private set; } public static ConfigEntry PlayerHudHealthBarHeight { get; private set; } public static ConfigEntry PlayerHudHealthBarColor { get; private set; } public static ConfigEntry FloatingBossHud { get; private set; } public static ConfigEntry BossHudPositionOffset { get; private set; } public static ConfigEntry BossHudNameTextFontSize { get; private set; } public static ConfigEntry BossHudNameTextColor { get; private set; } public static ConfigEntry BossHudHealthTextFontSize { get; private set; } public static ConfigEntry BossHudHealthTextFontColor { get; private set; } public static ConfigEntry BossHudHealthBarWidth { get; private set; } public static ConfigEntry BossHudHealthBarHeight { get; private set; } public static ConfigEntry BossHudHealthBarColor { get; private set; } public static ConfigEntry EnemyHudPositionOffset { get; private set; } public static ConfigEntry EnemyHudNameTextFontSize { get; private set; } public static ConfigEntry EnemyHudNameTextColor { get; private set; } public static ConfigEntry EnemyHudUseNameForStatus { get; private set; } public static ConfigEntry EnemyHudNameTextAlertedColor { get; private set; } public static ConfigEntry EnemyHudNameTextAwareColor { get; private set; } public static ConfigEntry EnemyHudHealthTextColor { get; private set; } public static ConfigEntry EnemyHudHealthTextFontSize { get; private set; } public static ConfigEntry EnemyHudHealthBarWidth { get; private set; } public static ConfigEntry EnemyHudHealthBarHeight { get; private set; } public static ConfigEntry EnemyHudHealthBarColor { get; private set; } public static ConfigEntry EnemyHudHealthBarFriendlyColor { get; private set; } public static ConfigEntry EnemyHudHealthBarTamedColor { get; private set; } public static ConfigEntry EnemyLevelShowByName { get; private set; } public static ConfigEntry EnemyLevelStarSymbol { get; private set; } public static ConfigEntry EnemyLevelStarCutoff { get; private set; } public static ConfigEntry EnemyLevelTextMinFontSize { get; private set; } public static void BindConfig(ConfigFile config) { IsModEnabled = config.BindInOrder("_Global", "isModEnabled", defaultValue: true, "Globally enable or disable this mod."); ShowEnemyHealthValue = config.BindInOrder("EnemyHud", "showEnemyHealthValue", defaultValue: true, "Show enemy health values."); BindPlayerHudConfig(config); BindBossHudConfig(config); BindEnemyHudConfig(config); BindEnemyLevelConfig(config); } public static void BindPlayerHudConfig(ConfigFile config) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) PlayerHudShowLocalPlayer = config.BindInOrder("PlayerHud", "showLocalPlayer", defaultValue: false, "If true, shows a PlayerHud for the local player."); PlayerHudPositionOffset = config.BindInOrder("PlayerHud.Position", "positionOffset", new Vector3(0f, 0.3f, 0f), "PlayerHud position offset from head point."); PlayerHudNameTextFontSize = config.BindInOrder("PlayerHud.Name", "nameTextFontSize", 20, "PlayerHud.Name text font size.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 32)); PlayerHudNameTextColor = config.BindInOrder("PlayerHud.Name", "nameTextColor", new Color(1f, 0.7176f, 0.3603f, 1f), "PlayerHud.Name text color."); PlayerHudNameTextPvPColor = config.BindInOrder("PlayerHud.Name", "nameTextPvPColor", Color.red, "PlayerHud.Name text color when player has PvP enabled."); PlayerHudHealthTextFontSize = config.BindInOrder("PlayerHud.HealthText", "healthTextFontSize", 16, "PlayerHud.HealthText text font size.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 32)); PlayerHudHealthTextColor = config.BindInOrder("PlayerHud.HealthText", "healthTextColor", Color.white, "PlayerHud.HealthText text color."); PlayerHudHealthBarWidth = config.BindInOrder("PlayerHud.HealthBar", "healthBarWidth", 125f, "PlayerHud.HealthBar width (vanilla: 100).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1200f)); PlayerHudHealthBarHeight = config.BindInOrder("PlayerHud.HealthBar", "healthBarHeight", 22f, "PlayerHud.HealthBar height (vanilla: 5).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 90f)); PlayerHudHealthBarColor = config.BindInOrder("PlayerHud.HealthBar", "healthBarColor", new Color(0.2638f, 1f, 0.125f, 1f), "PlayerHud.HealthBar fast color for regular players."); } public static void BindBossHudConfig(ConfigFile config) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) FloatingBossHud = config.BindInOrder("BossHud", "floatingBossHud", defaultValue: true, "If set, each BossHud will float over the target enemy."); BossHudPositionOffset = config.BindInOrder("BossHud.Position", "positionOffset", new Vector3(0f, 1f, 0f), "BossHud position offset from top point."); BossHudNameTextFontSize = config.BindInOrder("BossHud.Name", "nameTextFontSize", 32, "BossHud.Name text font size (vanilla: 32).", (AcceptableValueBase)(object)new AcceptableValueRange(0, 64)); BossHudNameTextColor = config.BindInOrder("BossHud.Name", "nameTextColor", Color.white, "BossHud.Name text color."); BossHudHealthTextFontSize = config.BindInOrder("BossHud.HealthText", "healthTextFontSize", 24, "BossHud.HealthText font size.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 64)); BossHudHealthTextFontColor = config.BindInOrder("BossHud.HealthText", "healthTextColor", Color.white, "BossHud.HealthText text color."); BossHudHealthBarWidth = config.BindInOrder("BossHud.HealthBar", "healthBarWidth", 300f, "BossHud.HealthBar width (vanilla: 600).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1200f)); BossHudHealthBarHeight = config.BindInOrder("BossHud.HealthBar", "healthBarHeight", 30f, "BossHud.HealthBar height (vanilla: 15).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 90f)); BossHudHealthBarColor = config.BindInOrder("BossHud.HealthBar", "healthBarColor", new Color(1f, 0f, 0.3931f, 1f), "BossHud.HealthBar fast color."); } public static void BindEnemyHudConfig(ConfigFile config) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) EnemyHudPositionOffset = config.BindInOrder("EnemyHud.Position", "positionOffset", new Vector3(0f, 0.1f, 0f), "EnemyHud position offset from top point."); EnemyHudNameTextFontSize = config.BindInOrder("EnemyHud.Name", "nameTextFontSize", 16, "EnemyHud.Name text font size (vanilla: 16).", (AcceptableValueBase)(object)new AcceptableValueRange(0, 32)); EnemyHudNameTextColor = config.BindInOrder("EnemyHud.Name", "nameTextColor", Color.white, "EnemyHud.Name text color (vanilla: white)."); EnemyHudUseNameForStatus = config.BindInOrder("EnemyHud.Name.Status", "useNameForStatus", defaultValue: true, "Use the EnemyHud.Name text color for alerted/aware status."); EnemyHudNameTextAlertedColor = config.BindInOrder("EnemyHud.Name.Status", "nameTextAlertedColor", Color.red, "EnemyHud.Name text color for alerted status."); EnemyHudNameTextAwareColor = config.BindInOrder("EnemyHud.Name.Status", "nameTextAwareColor", Color.yellow, "EnemyHud.Name text color for aware status."); EnemyHudHealthTextFontSize = config.BindInOrder("EnemyHud.HealthText", "healthTextFontSize", 14, "EnemyHud.HealthText text font size.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 32)); EnemyHudHealthTextColor = config.BindInOrder("EnemyHud.HealthText", "healthTextColor", Color.white, "EnemyHud.HealthText text color."); EnemyHudHealthBarWidth = config.BindInOrder("EnemyHud.HealthBar", "healthBarWidth", 125f, "EnemyHud.HealthBar width (vanilla: 100).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1200f)); EnemyHudHealthBarHeight = config.BindInOrder("EnemyHud.HealthBar", "healthBarHeight", 22f, "EnemyHud.HealthBar height (vanilla: 5).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 90f)); EnemyHudHealthBarColor = config.BindInOrder("EnemyHud.HealthBar", "healthBarColor", new Color(1f, 0.333f, 0.333f, 1f), "EnemyHud.HealthBar fast color for regular mobs."); EnemyHudHealthBarFriendlyColor = config.BindInOrder("EnemyHud.HealthBar", "healthBarFriendlyColor", new Color(0.2638f, 1f, 0.125f, 1f), "EnemyHud.HealthBar fast color for friendly (but not tamed) mobs."); EnemyHudHealthBarTamedColor = config.BindInOrder("EnemyHud.HealthBar", "healthBarTamedColor", Color.green, "EnemyHud.HealthBar fast color for tamed mobs."); } public static void BindEnemyLevelConfig(ConfigFile config) { EnemyLevelShowByName = config.BindInOrder("EnemyLevel", "enemyLevelShowByName", defaultValue: false, "If true, shows the enemy level after the name, otherwise below healthbar."); EnemyLevelStarSymbol = config.BindInOrder("EnemyLevel", "enemyLevelStarSymbol", "★", "Symbol to use for 'star' for enemy levels above vanilla 2*.", (AcceptableValueBase)(object)new AcceptableValueList(new string[5] { "★", "✪", "✵", "✭", "✫" })); EnemyLevelStarCutoff = config.BindInOrder("EnemyLevel", "enemyLevelStarCutoff", 2, "When showing enemy levels using stars, max stars to show before switching to 'X★' format.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 10)); EnemyLevelTextMinFontSize = config.BindInOrder("EnemyLevel", "enemyLevelMinFontSize", 20, "Sets a minimum font size for the enemy level text which is inherited from enemy name text font size.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 32)); } } public static class CodeMatcherExtensions { public static CodeMatcher SaveOperand(this CodeMatcher matcher, out object operand) { operand = matcher.Operand; return matcher; } } public static class ObjectExtensions { public static T Ref(this T o) where T : Object { if (!Object.op_Implicit((Object)(object)o)) { return default(T); } return o; } } }