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.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.3.2")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.2.0")]
[module: UnverifiableCode]
namespace ComfyLib
{
public static class ConfigFileExtensions
{
internal sealed class ConfigurationManagerAttributes
{
public Action<ConfigEntryBase> CustomDrawer;
public bool? Browsable;
public bool? HideDefaultButton;
public int? Order;
}
private static readonly Dictionary<string, int> _sectionToSettingOrder = new Dictionary<string, int>();
private static int GetSettingOrder(string section)
{
if (!_sectionToSettingOrder.TryGetValue(section, out var value))
{
value = 0;
}
_sectionToSettingOrder[section] = value - 1;
return value;
}
public static ConfigEntry<T> BindInOrder<T>(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<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, new object[1]
{
new ConfigurationManagerAttributes
{
Order = GetSettingOrder(section)
}
}));
}
public static ConfigEntry<T> BindInOrder<T>(this ConfigFile config, string section, string key, T defaultValue, string description, Action<ConfigEntryBase> customDrawer = null, bool browsable = true, bool hideDefaultButton = false, bool hideSettingName = false)
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
return config.Bind<T>(section, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = browsable,
CustomDrawer = customDrawer,
HideDefaultButton = hideDefaultButton,
Order = GetSettingOrder(section)
}
}));
}
public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action settingChangedHandler)
{
configEntry.SettingChanged += delegate
{
settingChangedHandler();
};
}
public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action<T> settingChangedHandler)
{
configEntry.SettingChanged += delegate(object _, EventArgs eventArgs)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
settingChangedHandler((T)((SettingChangedEventArgs)eventArgs).ChangedSetting.BoxedValue);
};
}
public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action<ConfigEntry<T>> settingChangedHandler)
{
configEntry.SettingChanged += delegate(object _, EventArgs eventArgs)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
settingChangedHandler((ConfigEntry<T>)((SettingChangedEventArgs)eventArgs).ChangedSetting.BoxedValue);
};
}
}
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<T>(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<T>(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<T>(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<T>(this T tmpText, bool enableAutoSizing) where T : TMP_Text
{
((TMP_Text)tmpText).enableAutoSizing = enableAutoSizing;
return tmpText;
}
public static T SetFont<T>(this T tmpText, TMP_FontAsset font) where T : TMP_Text
{
((TMP_Text)tmpText).font = font;
return tmpText;
}
public static T SetFontSize<T>(this T tmpText, float fontSize) where T : TMP_Text
{
((TMP_Text)tmpText).fontSize = fontSize;
return tmpText;
}
public static T SetFontMaterial<T>(this T tmpText, Material fontMaterial) where T : TMP_Text
{
((TMP_Text)tmpText).fontMaterial = fontMaterial;
return tmpText;
}
public static T SetMargin<T>(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<T>(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<T>(this T tmpText, bool richText) where T : TMP_Text
{
((TMP_Text)tmpText).richText = richText;
return tmpText;
}
public static T SetTextWrappingMode<T>(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<Character> _keysToRemove = new List<Character>(12);
public static void UpdateHuds(ref EnemyHud enemyHud, ref Player player, ref Sadle sadle, float dt, ConditionalWeakTable<HudData, TextMeshProUGUI> 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<Sadle>();
Character val = ((obj != null) ? obj.GetCharacter() : null);
Player obj2 = player.Ref<Player>();
Character val2 = ((obj2 != null) ? obj2.GetHoverCreature() : null);
_keysToRemove.Clear();
foreach (KeyValuePair<Character, HudData> 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<TextMeshProUGUI>(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<TextMeshProUGUI>((!(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 = Utils.WorldToScreenPointScaled(mainCamera, 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.3.2")]
public class Enhuddlement : BaseUnityPlugin
{
public const string PluginGuid = "redseiko.valheim.enhuddlement";
public const string PluginName = "Enhuddlement";
public const string PluginVersion = "1.3.2";
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<HudData, TextMeshProUGUI> _healthTextCache = new ConditionalWeakTable<HudData, TextMeshProUGUI>();
[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)
//IL_0063: 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)
SetupName(hudData, PluginConfig.BossHudNameTextFontSize.Value, PluginConfig.BossHudNameTextColorTop.Value);
SetupHud(hudData, PluginConfig.BossHudHealthTextFontSize.Value, PluginConfig.BossHudHealthTextFontColor.Value, PluginConfig.BossHudHealthBarWidth.Value, PluginConfig.BossHudHealthBarHeight.Value);
hudData.m_healthFast.SetColor(PluginConfig.BossHudHealthBarColor.Value);
SetupNameGradient(hudData, PluginConfig.BossHudNameTextColorTop.Value, PluginConfig.BossHudNameTextColorBottom.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<TextMeshProUGUI>(nameTextColor).SetFontSize<TextMeshProUGUI>((float)nameTextFontSize).SetTextWrappingMode<TextMeshProUGUI>((TextWrappingModes)0)
.SetOverflowMode<TextMeshProUGUI>((TextOverflowModes)0)
.SetAlignment<TextMeshProUGUI>((TextAlignmentOptions)1026)
.SetEnableAutoSizing<TextMeshProUGUI>(enableAutoSizing: false);
((Component)hudData.m_name).GetComponent<RectTransform>().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 SetupNameGradient(HudData hudData, Color topColor, Color bottomColor)
{
//IL_0014: 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_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
((TMP_Text)hudData.m_name).enableVertexGradient = true;
((TMP_Text)hudData.m_name).colorGradient = new VertexGradient
{
topLeft = topColor,
topRight = topColor,
bottomLeft = bottomColor,
bottomRight = bottomColor
};
}
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<RectTransform>().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<RectTransform>().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<RectTransform>().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<GuiBar>();
if (obj != null)
{
((Component)obj).gameObject.SetActive(false);
}
}
private static void SetupLevel(HudData hudData, Transform healthTransform)
{
if (!PluginConfig.EnemyLevelUseVanillaStar.Value || hudData.m_character.m_level > (hudData.m_character.IsBoss() ? 1 : 3))
{
CreateEnemyLevelText(hudData, healthTransform);
RectTransform obj = hudData.m_level2.Ref<RectTransform>();
if (obj != null)
{
((Component)obj).gameObject.SetActive(false);
}
RectTransform obj2 = hudData.m_level3.Ref<RectTransform>();
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<TextMeshProUGUI>();
((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<TextMeshProUGUI>(hudData.m_name);
((TMP_Text)obj).transform.SetParent(parentTransform, false);
((Object)obj).name = "HealthText";
((Component)obj).GetComponent<RectTransform>().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<TextMeshProUGUI>(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<RectTransform>().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<RectTransform>().sizeDelta;
sizeDelta.y = ((TMP_Text)val).GetPreferredValues().y * 2f;
((Component)val).GetComponent<RectTransform>().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<CodeInstruction> LateUpdateTranspiler(IEnumerable<CodeInstruction> 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<Character, Player, bool>>((Func<Character, Player, bool>)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<string> _targetHarmonyIds = new HashSet<string> { "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<bool> IsModEnabled { get; private set; }
public static ConfigEntry<bool> ShowEnemyHealthValue { get; private set; }
public static ConfigEntry<bool> PlayerHudShowLocalPlayer { get; private set; }
public static ConfigEntry<Vector3> PlayerHudPositionOffset { get; private set; }
public static ConfigEntry<int> PlayerHudNameTextFontSize { get; private set; }
public static ConfigEntry<Color> PlayerHudNameTextColor { get; private set; }
public static ConfigEntry<Color> PlayerHudNameTextPvPColor { get; private set; }
public static ConfigEntry<int> PlayerHudHealthTextFontSize { get; private set; }
public static ConfigEntry<Color> PlayerHudHealthTextColor { get; private set; }
public static ConfigEntry<float> PlayerHudHealthBarWidth { get; private set; }
public static ConfigEntry<float> PlayerHudHealthBarHeight { get; private set; }
public static ConfigEntry<Color> PlayerHudHealthBarColor { get; private set; }
public static ConfigEntry<bool> FloatingBossHud { get; private set; }
public static ConfigEntry<Vector3> BossHudPositionOffset { get; private set; }
public static ConfigEntry<int> BossHudNameTextFontSize { get; private set; }
public static ConfigEntry<Color> BossHudNameTextColorTop { get; private set; }
public static ConfigEntry<Color> BossHudNameTextColorBottom { get; private set; }
public static ConfigEntry<int> BossHudHealthTextFontSize { get; private set; }
public static ConfigEntry<Color> BossHudHealthTextFontColor { get; private set; }
public static ConfigEntry<float> BossHudHealthBarWidth { get; private set; }
public static ConfigEntry<float> BossHudHealthBarHeight { get; private set; }
public static ConfigEntry<Color> BossHudHealthBarColor { get; private set; }
public static ConfigEntry<Vector3> EnemyHudPositionOffset { get; private set; }
public static ConfigEntry<int> EnemyHudNameTextFontSize { get; private set; }
public static ConfigEntry<Color> EnemyHudNameTextColor { get; private set; }
public static ConfigEntry<bool> EnemyHudUseNameForStatus { get; private set; }
public static ConfigEntry<Color> EnemyHudNameTextAlertedColor { get; private set; }
public static ConfigEntry<Color> EnemyHudNameTextAwareColor { get; private set; }
public static ConfigEntry<Color> EnemyHudHealthTextColor { get; private set; }
public static ConfigEntry<int> EnemyHudHealthTextFontSize { get; private set; }
public static ConfigEntry<float> EnemyHudHealthBarWidth { get; private set; }
public static ConfigEntry<float> EnemyHudHealthBarHeight { get; private set; }
public static ConfigEntry<Color> EnemyHudHealthBarColor { get; private set; }
public static ConfigEntry<Color> EnemyHudHealthBarFriendlyColor { get; private set; }
public static ConfigEntry<Color> EnemyHudHealthBarTamedColor { get; private set; }
public static ConfigEntry<bool> EnemyLevelShowByName { get; private set; }
public static ConfigEntry<bool> EnemyLevelUseVanillaStar { get; private set; }
public static ConfigEntry<string> EnemyLevelStarSymbol { get; private set; }
public static ConfigEntry<int> EnemyLevelStarCutoff { get; private set; }
public static ConfigEntry<int> 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_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: 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<Vector3>("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<int>(0, 32));
PlayerHudNameTextColor = config.BindInOrder<Color>("PlayerHud.Name", "nameTextColor", new Color(1f, 0.7176f, 0.3603f, 1f), "PlayerHud.Name text color.");
PlayerHudNameTextPvPColor = config.BindInOrder<Color>("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<int>(0, 32));
PlayerHudHealthTextColor = config.BindInOrder<Color>("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<float>(0f, 1200f));
PlayerHudHealthBarHeight = config.BindInOrder("PlayerHud.HealthBar", "healthBarHeight", 22f, "PlayerHud.HealthBar height (vanilla: 5).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 90f));
PlayerHudHealthBarColor = config.BindInOrder<Color>("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_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: 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)
FloatingBossHud = config.BindInOrder("BossHud", "floatingBossHud", defaultValue: true, "If set, each BossHud will float over the target enemy.");
BossHudPositionOffset = config.BindInOrder<Vector3>("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<int>(0, 64));
BossHudNameTextColorTop = config.BindInOrder<Color>("BossHud.Name", "nameTextColorTop", Color.red, "BossHud.Name text top-color for vertical gradient.");
BossHudNameTextColorBottom = config.BindInOrder<Color>("BossHud.Name", "nameTextColorBottom", Color.black, "BossHud.Name text bottom color for vertical gradient.");
BossHudHealthTextFontSize = config.BindInOrder("BossHud.HealthText", "healthTextFontSize", 24, "BossHud.HealthText font size.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 64));
BossHudHealthTextFontColor = config.BindInOrder<Color>("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<float>(0f, 1200f));
BossHudHealthBarHeight = config.BindInOrder("BossHud.HealthBar", "healthBarHeight", 30f, "BossHud.HealthBar height (vanilla: 15).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 90f));
BossHudHealthBarColor = config.BindInOrder<Color>("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_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
EnemyHudPositionOffset = config.BindInOrder<Vector3>("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<int>(0, 32));
EnemyHudNameTextColor = config.BindInOrder<Color>("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<Color>("EnemyHud.Name.Status", "nameTextAlertedColor", Color.red, "EnemyHud.Name text color for alerted status.");
EnemyHudNameTextAwareColor = config.BindInOrder<Color>("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<int>(0, 32));
EnemyHudHealthTextColor = config.BindInOrder<Color>("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<float>(0f, 1200f));
EnemyHudHealthBarHeight = config.BindInOrder("EnemyHud.HealthBar", "healthBarHeight", 22f, "EnemyHud.HealthBar height (vanilla: 5).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 90f));
EnemyHudHealthBarColor = config.BindInOrder<Color>("EnemyHud.HealthBar", "healthBarColor", new Color(1f, 0.333f, 0.333f, 1f), "EnemyHud.HealthBar fast color for regular mobs.");
EnemyHudHealthBarFriendlyColor = config.BindInOrder<Color>("EnemyHud.HealthBar", "healthBarFriendlyColor", new Color(0.2638f, 1f, 0.125f, 1f), "EnemyHud.HealthBar fast color for friendly (but not tamed) mobs.");
EnemyHudHealthBarTamedColor = config.BindInOrder<Color>("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.");
EnemyLevelUseVanillaStar = config.BindInOrder("EnemyLevel", "enemyLevelUseVanillaStar", defaultValue: false, "If true, uses the vanilla 'star' image for 1* and 2* monsters.");
EnemyLevelStarSymbol = config.BindInOrder("EnemyLevel", "enemyLevelStarSymbol", "★", "Symbol to use for 'star' for enemy levels above vanilla 2*.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[6] { "★", "☆", "✴", "✳", "❖", "✖" }));
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<int>(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<int>(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<T>(this T o) where T : Object
{
if (!Object.op_Implicit((Object)(object)o))
{
return default(T);
}
return o;
}
}
}