Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ImmersiveHud v1.3.4
ImmersiveHud/ImmersiveHud.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ImmersiveHud")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ImmersiveHud")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("6a171b4f-ba83-4d4f-a1e3-7f0d52a965fa")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] internal sealed class ConfigurationManagerAttributes { public bool? ShowRangeAsPercent; public Action<ConfigEntryBase> CustomDrawer; public bool? Browsable; public string Category; public object DefaultValue; public bool? HideDefaultButton; public bool? HideSettingName; public string Description; public string DispName; public int? Order; public bool? ReadOnly; public bool? IsAdvanced; public Func<object, string> ObjToStr; public Func<string, object> StrToObj; } namespace ImmersiveHud; [HarmonyPatch] [HarmonyPatch] [HarmonyPatch] [BepInPlugin("jwlei.ImmersiveHud", "Immersive Hud", "1.3.3")] [BepInProcess("valheim.exe")] [BepInProcess("valheim_server.exe")] public class ImmersiveHud : BaseUnityPlugin { [HarmonyPatch(typeof(Hud), "Awake")] public static class PatchHudAwake { private static void Postfix(Hud __instance) { if (isEnabled.Value) { Transform val = ((Component)__instance).transform.Find("hudroot"); hudElements = new Dictionary<string, HudElement>(); HudElementAddCanvasGroup(val); hudHidden = hudHiddenOnStart.Value; HudSetValueCrosshair(__instance); HudSetValuesStealth(__instance); HudAddCanvasGroupStealth(); SetCrosshairSprite(); setCompatibilityInit(); setCompatibility(val); } } } [HarmonyPatch(typeof(Character), "Damage")] public static class PatchPlayerCheckDamaged { private static void Prefix(Character __instance, HitData hit) { if (__instance is Player && hit.GetTotalDamage() > 0f) { playerTookDamage = true; } } } [HarmonyPatch(typeof(Player), "Update")] public static class PatchPlayerCheckBowEquipped { private static void Prefix(Player __instance) { if (Object.op_Implicit((Object)(object)__instance)) { ItemData currentWeapon = ((Humanoid)__instance).GetCurrentWeapon(); CheckPlayerEquippedWeapon(currentWeapon); } } } [HarmonyPatch(typeof(Player), "UseHotbarItem")] public static class PatchPlayerCheckHotbarItemUsed { private static void Postfix(int index) { Player localPlayer = Player.m_localPlayer; ItemData itemAt = ((Humanoid)localPlayer).GetInventory().GetItemAt(index - 1, 0); if (itemAt != null) { playerUsedHotBarItem = true; } } } [HarmonyPatch(typeof(Player), "UseStamina")] public static class PatchPlayerCheckStaminaChanged { private static void Postfix(ref float v) { if ((double)v != 0.0) { playerUsedStamina = true; } } } [HarmonyPatch] public static class PatchPlayerCheckFoodEaten { private static MethodBase TargetMethod() { return typeof(Player).GetMethod("UpdateFood", BindingFlags.Instance | BindingFlags.NonPublic); } private static void Postfix(ref float dt, ref bool forceUpdate) { if ((dt == 0f) & forceUpdate) { playerAteFood = true; } else { playerAteFood = false; } } } [HarmonyPatch(typeof(Hud), "UpdateCrosshair")] public static class PatchCrosshair { private static void Postfix(Player player, float bowDrawPercentage) { SetCrosshairValues(player); SetStealthHudValues(); UpdateCrosshairHudElement(bowDrawPercentage); UpdateStealthHudElement(); } } [HarmonyPatch(typeof(Hud), "Update")] public static class PatchHudSetVisibility { private static void Postfix(Hud __instance) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!isEnabled.Value || !Object.op_Implicit((Object)(object)localPlayer) || !Object.op_Implicit((Object)(object)__instance)) { return; } Transform val = ((Component)__instance).transform.Find("hudroot"); GetPlayerState(val, localPlayer); setCompatibility(val); KeyboardShortcut value = hideHudKey.Value; bool keyDown = Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey); value = showHudKey.Value; HudSetValues(keyDown, Input.GetKey(((KeyboardShortcut)(ref value)).MainKey)); if (!AzuMinimalUiEnabled.Value) { ForceVanillaStaminabar(__instance); } string[] hudElementNames = ImmersiveHud.hudElementNames; foreach (string key in hudElementNames) { if (hudElements[key].exists && !((Object)(object)hudElements[key].element == (Object)null)) { hudElements[key].HudCheckLerpDuration(hudFadeDuration); if (!hudElements[key].targetAlphaReached) { hudElements[key].timeFade += Time.deltaTime; HudUpdateTransparency(hudElements[key], showHudDuration); } else { hudElements[key].timeDisplayed += Time.deltaTime; } } } } } public enum notificationTypes { SmallTopLeft, LargeCenter } public enum hungerNotificationOptions { FoodHungerAmount, FoodPercentage } public class HudElement { public Transform element; public string elementName; public float timeFade; public float timeDisplayed; public float targetAlphaPrev; public float targetAlpha; public float lastSetAlpha; public bool exists = false; public bool targetAlphaReached; public bool isVisible; public HudElement(string name) { element = null; elementName = name; } public void setElement(Transform e) { if ((Object)(object)e != (Object)null) { element = e; exists = true; } } public void HudSetTargetAlpha(float alpha) { if (!isVisible) { targetAlpha = alpha; } } public void HudCheckLerpDuration(ConfigEntry<float> duration) { if (timeFade >= duration.Value) { targetAlphaReached = true; } else { targetAlphaReached = false; } } public void ShowHudForDuration() { if (exists) { targetAlpha = 1f; timeDisplayed = 0f; isVisible = true; } } public void HudElementCheckDisplayTimer(ConfigEntry<float> duration) { if (timeDisplayed >= duration.Value && isVisible) { targetAlpha = 0f; isVisible = false; } } public void ResetTimers() { timeFade = 0f; timeDisplayed = 0f; } } [HarmonyPatch(typeof(Hud), "Update")] public static class PatchCompatibilityIdentification { private static void Postfix(Hud __instance) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) Transform hud = ((Component)__instance).transform.Find("hudroot"); KeyboardShortcut value = compatibilityIdHotkey.Value; DebugListOfMissingElements(hud, Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey)); value = listAllElementsHotkey.Value; DebugListOfHudElements(hud, Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey)); } } private static float targetCrosshairAlpha; private static float targetBowDrawCrosshairAlpha; private static Image playerCrosshair; private static Image playerBowCrosshair; private static Sprite crosshairSpriteOriginal; private static Sprite crosshairBowSpriteOriginal; private static string crosshairSprite = "ImmersiveHud/crosshair.png"; private static string crosshairBowSprite = "ImmersiveHud/bowcrosshair.png"; private static bool isMiniMapActive; private static float fadeDuration = 0.5f; private static float notificationTimer = 0f; private static bool hudHidden; public static float targetStealthHudAlpha; public static GuiBar playerStealthBar; public static GameObject playerStealthIndicator; public static GameObject playerStealthIndicatorTargeted; public static GameObject playerStealthIndicatorAlert; public static float playerTotalFoodValue; public static float playerCurrentFoodValue; public static float playerFoodPercentage; public static int playerHungerCount; public static bool characterEquippedItem; public static bool characterEquippedBow; public static bool isLookingAtActivatable; public static bool playerUsedStamina; public static bool playerAteFood; public static bool playerUsedHotBarItem; public static bool playerUsedQuickSlotsItem; public static bool playerHasItemEquipped; public static bool playerTookDamage; public static ConfigEntry<bool> isEnabled; public static ConfigEntry<int> nexusID; public static ConfigEntry<KeyboardShortcut> hideHudKey; public static ConfigEntry<KeyboardShortcut> showHudKey; public static ConfigEntry<bool> hudHiddenNotification; public static ConfigEntry<bool> hudHiddenOnStart; public static ConfigEntry<float> hudFadeDuration; public static ConfigEntry<float> showHudDuration; public static ConfigEntry<float> displayHealthOnDamageDuration; public static ConfigEntry<bool> useCustomCrosshair; public static ConfigEntry<bool> useCustomBowCrosshair; public static ConfigEntry<Color> crosshairColor; public static ConfigEntry<Color> crosshairBowDrawColor; public static ConfigEntry<bool> disableStealthHud; public static ConfigEntry<bool> displayCrosshairAlways; public static ConfigEntry<bool> displayCrosshairWhenBuilding; public static ConfigEntry<bool> displayCrosshairOnActivation; public static ConfigEntry<bool> displayCrosshairOnEquipped; public static ConfigEntry<bool> displayCrosshairOnBowEquipped; public static ConfigEntry<bool> displayBowDrawCrosshair; public static ConfigEntry<bool> disableCrosshairStamina; public static ConfigEntry<bool> displayHealthAlways; public static ConfigEntry<bool> displayKeyHintsAlways; public static ConfigEntry<bool> displayHotKeyBarAlways; public static ConfigEntry<bool> displayForsakenPowerAlways; public static ConfigEntry<bool> displayStatusEffectsAlways; public static ConfigEntry<bool> displayStaminaBarAlways; public static ConfigEntry<bool> displayMiniMapAlways; public static ConfigEntry<bool> displayQuickSlotsAlways; public static ConfigEntry<bool> displayFoodBarAlways; public static ConfigEntry<bool> displayCompassAlways; public static ConfigEntry<bool> displayTimeAlways; public static ConfigEntry<bool> RandyQuickSlotsEnabled; public static ConfigEntry<bool> BetterUIEnabled; public static ConfigEntry<bool> aedenCompassEnabled; public static ConfigEntry<bool> oryxenTimeEnabled; public static ConfigEntry<bool> AzuQuickSlotsEnabled; public static ConfigEntry<bool> AzuMinimalUiEnabled; public static ConfigEntry<bool> displayHealthInInventory; public static ConfigEntry<bool> displayHealthWhenHungry; public static ConfigEntry<bool> displayHealthOnDamage; public static ConfigEntry<bool> displayHealthOnDamageSeparateTimer; public static ConfigEntry<bool> displayHealthWhenEating; public static ConfigEntry<bool> displayHealthWhenBelow; public static ConfigEntry<bool> displayHealthWhenFoodBelow; public static ConfigEntry<float> healthPercentage; public static ConfigEntry<bool> showHealthOnKeyPressed; public static ConfigEntry<int> foodHungerAmount; public static ConfigEntry<float> foodPercentage; public static ConfigEntry<bool> hungerNotification; public static ConfigEntry<int> hungerNotificationInterval; public static ConfigEntry<hungerNotificationOptions> hungerNotificationOption; public static ConfigEntry<string> hungerNotificationText; public static ConfigEntry<notificationTypes> hungerNotificationType; public static ConfigEntry<bool> displayFoodBarInInventory; public static ConfigEntry<bool> displayFoodBarWhenHungry; public static ConfigEntry<bool> displayFoodBarWhenEating; public static ConfigEntry<bool> displayFoodBarWhenBelow; public static ConfigEntry<bool> showFoodBarOnKeyPressed; public static ConfigEntry<bool> displayStaminaBarInInventory; public static ConfigEntry<bool> displayStaminaBarOnUse; public static ConfigEntry<bool> displayStaminaBarWhenHungry; public static ConfigEntry<bool> displayStaminaBarWhenEating; public static ConfigEntry<bool> displayStaminaBarWhenBelow; public static ConfigEntry<bool> displayStaminaBarWhenFoodBelow; public static ConfigEntry<float> staminaPercentage; public static ConfigEntry<bool> showStaminaBarOnKeyPressed; public static ConfigEntry<bool> displayPowerInInventory; public static ConfigEntry<bool> displayPowerOnActivation; public static ConfigEntry<bool> displayPowerWhenTimeChanges; public static ConfigEntry<bool> displayPowerOnReady; public static ConfigEntry<float> powerTimeChangeInterval; public static ConfigEntry<bool> showPowerOnKeyPressed; public static ConfigEntry<bool> displayHotKeyBarInInventory; public static ConfigEntry<bool> displayHotKeyBarOnItemSwitch; public static ConfigEntry<bool> displayHotKeyBarWhenItemEquipped; public static ConfigEntry<bool> showHotKeyBarOnKeyPressed; public static ConfigEntry<bool> displayStatusEffectsInInventory; public static ConfigEntry<bool> showStatusEffectsOnKeyPressed; public static ConfigEntry<bool> displayMiniMapInInventory; public static ConfigEntry<bool> showMiniMapOnKeyPressed; public static ConfigEntry<bool> displayCompassInInventory; public static ConfigEntry<bool> showCompassOnKeyPressed; public static ConfigEntry<bool> displayTimeInInventory; public static ConfigEntry<bool> showTimeOnKeyPressed; public static ConfigEntry<bool> displayQuickSlotsInInventory; public static ConfigEntry<bool> showQuickSlotsOnKeyPressed; public static ConfigEntry<bool> showKeyHintsOnKeyPressed; public static ConfigEntry<bool> muiMinimap; public static ConfigEntry<bool> muiHealthbar; public static ConfigEntry<bool> muiStaminabar; public static ConfigEntry<bool> muiEitrbar; public static ConfigEntry<bool> muiPowerbar; public static ConfigEntry<bool> muiFoodbar; public static ConfigEntry<bool> muiFoodbox; public static ConfigEntry<KeyboardShortcut> compatibilityIdHotkey; public static ConfigEntry<KeyboardShortcut> listAllElementsHotkey; private const string MID = "jwlei.ImmersiveHud"; private const string modName = "Immersive Hud"; private const string pluginVersion = "1.3.3"; public static Dictionary<string, HudElement> hudElements; public static string[] hudElementNames = new string[23] { "healthpanel", "staminapanel", "GuardianPower", "HotKeyBar", "StatusEffects", "MiniMap", "QuickSlotsHotkeyBar", "BetterUI_HPBar", "BetterUI_FoodBar", "BetterUI_StaminaBar", "Compass", "DayTimePanel", "KeyHints", "QuickAccessBar", "MUIMap", "MUI_HPBar", "MUI_StaminaBar", "MUI_EitrBar", "MUI_GuardianPowerBar", "MUI_FoodBar", "food0", "food1", "food2" }; public static void UpdateCrosshairHudElement(float bowDrawPercentage) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) ((Graphic)playerCrosshair).CrossFadeAlpha(targetCrosshairAlpha, fadeDuration, false); if ((double)bowDrawPercentage > 0.0) { if (useCustomBowCrosshair.Value) { float num = Mathf.Lerp(0.75f, 0.25f, bowDrawPercentage); ((Component)playerBowCrosshair).transform.localScale = new Vector3(num, num, num); } if (displayBowDrawCrosshair.Value) { ((Graphic)playerBowCrosshair).color = Color.Lerp(new Color(1f, 1f, 1f, 0f), crosshairBowDrawColor.Value, bowDrawPercentage); } else { ((Graphic)playerBowCrosshair).color = new Color(0f, 0f, 0f, 0f); } } } public static void UpdateStealthHudElement() { ((Component)playerStealthBar).GetComponent<CanvasGroup>().alpha = targetStealthHudAlpha; playerStealthIndicator.GetComponent<CanvasGroup>().alpha = targetStealthHudAlpha; playerStealthIndicatorTargeted.GetComponent<CanvasGroup>().alpha = targetStealthHudAlpha; playerStealthIndicatorAlert.GetComponent<CanvasGroup>().alpha = targetStealthHudAlpha; } public static void SetCrosshairValues(Player player) { GameObject hoverObject = ((Humanoid)player).GetHoverObject(); Hoverable val = (Object.op_Implicit((Object)(object)hoverObject) ? hoverObject.GetComponentInParent<Hoverable>() : null); if (val != null && !TextViewer.instance.IsVisible()) { isLookingAtActivatable = true; } else { isLookingAtActivatable = false; } UpdateTargetCrosshairAlpha(player); } private static void UpdateTargetCrosshairAlpha(Player player) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_00da: Unknown result type (might be due to invalid IL or missing references) if (displayCrosshairAlways.Value) { targetCrosshairAlpha = crosshairColor.Value.a; } else if (displayCrosshairWhenBuilding.Value && ((Character)player).InPlaceMode()) { targetCrosshairAlpha = crosshairColor.Value.a; } else if (displayCrosshairOnActivation.Value && isLookingAtActivatable) { targetCrosshairAlpha = crosshairColor.Value.a; } else if (displayCrosshairOnEquipped.Value && characterEquippedItem) { targetCrosshairAlpha = crosshairColor.Value.a; } else if (displayCrosshairOnBowEquipped.Value && characterEquippedBow) { targetCrosshairAlpha = crosshairColor.Value.a; } else { targetCrosshairAlpha = 0f; } } public static void SetStealthHudValues() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (disableStealthHud.Value || hudHidden) { targetStealthHudAlpha = 0f; } else { targetStealthHudAlpha = crosshairColor.Value.a; } } public static Sprite LoadCrosshairTexture(string filename) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) string path = Path.Combine(Paths.PluginPath, filename); if (File.Exists(path)) { Texture2D val = new Texture2D(0, 0); ImageConversion.LoadImage(val, File.ReadAllBytes(path)); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero); } Debug.Log((object)"ImmersiveHud: Error. Couldn't load provided crosshair image. Check if the folder ImmersiveHud in the plugins folder has a file named crosshair.png or bowcrosshair.png"); return null; } private static void SetCrosshairSprite() { crosshairSpriteOriginal = playerCrosshair.sprite; crosshairBowSpriteOriginal = playerBowCrosshair.sprite; if (useCustomCrosshair.Value && crosshairSprite != null) { playerCrosshair.sprite = LoadCrosshairTexture(crosshairSprite); } if (useCustomBowCrosshair.Value && crosshairBowSprite != null) { playerBowCrosshair.sprite = LoadCrosshairTexture(crosshairBowSprite); } } private static void RemovePieceHealthBar() { Player localPlayer = Player.m_localPlayer; Piece hoveringPiece = localPlayer.GetHoveringPiece(); Debug.Log((object)hoveringPiece); WearNTear component = ((Component)hoveringPiece).GetComponent<WearNTear>(); Debug.Log((object)component); ((Behaviour)component).enabled = false; } public static void HudUpdateTransparency(HudElement hudElement, ConfigEntry<float> duration) { float num = Mathf.Lerp(hudElement.lastSetAlpha, hudElement.targetAlpha, hudElement.timeFade / duration.Value); if (hudElement.elementName == "MiniMap") { ((Graphic)((Component)hudElement.element).GetComponent<Minimap>().m_mapImageSmall).CrossFadeAlpha(hudElement.targetAlpha, hudElement.timeFade, false); } hudElement.lastSetAlpha = num; ((Component)hudElement.element).GetComponent<CanvasGroup>().alpha = num; } public static void GetPlayerState(Transform hud, Player player) { Minimap component = ((Component)hud.Find("MiniMap")).GetComponent<Minimap>(); bool flag = isMiniMapActive; isMiniMapActive = component.m_smallRoot.activeSelf; if (flag != isMiniMapActive) { hudElements["MiniMap"].timeFade = 0f; hudElements["MUIMap"].timeFade = 0f; } GetPlayerTotalFoodValue(player); ItemData currentWeapon = ((Humanoid)player).GetCurrentWeapon(); if (currentWeapon != null) { playerHasItemEquipped = true; } else { playerHasItemEquipped = false; } } public static void GetPlayerTotalFoodValue(Player player) { playerTotalFoodValue = (playerCurrentFoodValue = (playerHungerCount = 0)); foreach (Food food in player.GetFoods()) { playerTotalFoodValue += food.m_item.m_shared.m_food; playerCurrentFoodValue += food.m_health; if (food.CanEatAgain()) { playerHungerCount++; } } playerFoodPercentage = playerCurrentFoodValue / playerTotalFoodValue; } public static void HudSetValues(bool pressedHideKey, bool pressedShowKey) { Player localPlayer = Player.m_localPlayer; string[] array = hudElementNames; foreach (string key in array) { if ((Object)(object)hudElements[key].element != (Object)null) { hudElements[key].targetAlphaPrev = hudElements[key].targetAlpha; } } CheckPressedHideHud(pressedHideKey); CheckHungerNotification(); if (hudHidden) { string[] array2 = hudElementNames; foreach (string key2 in array2) { hudElements[key2].targetAlpha = 0f; } if (isMiniMapActive) { CheckMinimapActive(); } } else if (pressedShowKey) { CheckPressedShowHud(); } else { CheckHealthBar(localPlayer); CheckFoodBar(); CheckStaminaBar(localPlayer); CheckForsakenPower(); CheckHotbar(); CheckStatusEffect(); CheckMinimap(); CheckCompass(); CheckDayTime(); CheckKeyHints(); CheckQuickSlots(); } string[] array3 = hudElementNames; foreach (string key3 in array3) { hudElements[key3].HudElementCheckDisplayTimer(showHudDuration); if (hudElements[key3].exists && !((Object)(object)hudElements[key3].element == (Object)null) && hudElements[key3].targetAlphaPrev != hudElements[key3].targetAlpha) { hudElements[key3].timeFade = 0f; } } SetPlayerStates(); } private static void ForceVanillaStaminabar(Hud __instance) { if (!hudElements["BetterUI_StaminaBar"].exists || !hudElements["MUI_StaminaBar"].exists) { ((Component)hudElements["staminapanel"].element).gameObject.SetActive(true); __instance.m_staminaAnimator.SetBool("Visible", true); } } private static void HudElementAddCanvasGroup(Transform hudRoot) { string[] array = hudElementNames; foreach (string text in array) { hudElements.Add(text, new HudElement(text)); if (!((Object)(object)hudRoot.Find(text) == (Object)null)) { hudElements[text].setElement(hudRoot.Find(text)); ((Component)((Component)hudElements[text].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); Debug.Log((object)(text + " added CanvasGroup")); } } } private static void HudAddCanvasGroupStealth() { ((Component)((Component)playerStealthBar).transform).gameObject.AddComponent<CanvasGroup>(); ((Component)playerStealthIndicator.transform).gameObject.AddComponent<CanvasGroup>(); ((Component)playerStealthIndicatorTargeted.transform).gameObject.AddComponent<CanvasGroup>(); ((Component)playerStealthIndicatorAlert.transform).gameObject.AddComponent<CanvasGroup>(); } private static void HudSetValueCrosshair(Hud __instance) { playerCrosshair = __instance.m_crosshair; playerBowCrosshair = __instance.m_crosshairBow; } private static void HudSetValuesStealth(Hud __instance) { playerStealthBar = __instance.m_stealthBar; playerStealthIndicator = __instance.m_hidden; playerStealthIndicatorTargeted = __instance.m_targeted; playerStealthIndicatorAlert = __instance.m_targetedAlert; } private static void DebugListOfMissingElements(Transform hud, bool keyPressed) { if (!keyPressed) { return; } Transform[] componentsInChildren = ((Component)hud).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (hudElements.ContainsKey(((Object)val).name) && !hudElements[((Object)val).name].exists) { Debug.Log((object)("WARN: Can't find UI element: [" + ((Object)val).name + "] does not exist")); } } } private static void DebugListOfHudElements(Transform hud, bool keyPressed) { if (keyPressed) { Debug.Log((object)"-------------------------------------------"); Transform[] componentsInChildren = ((Component)hud).GetComponentsInChildren<Transform>(false); foreach (Transform val in componentsInChildren) { Debug.Log((object)("[" + ((Object)val).name + "]")); } Debug.Log((object)"-------------------------------------------"); } } private static void CheckHungerNotification() { if (!hungerNotification.Value || ((hungerNotificationOption.Value != 0 || playerHungerCount < foodHungerAmount.Value) && (hungerNotificationOption.Value != hungerNotificationOptions.FoodPercentage || !(playerFoodPercentage <= foodPercentage.Value)))) { return; } notificationTimer += Time.deltaTime; if ((int)notificationTimer % hungerNotificationInterval.Value == 0) { switch (hungerNotificationType.Value) { case notificationTypes.SmallTopLeft: MessageHud.instance.ShowMessage((MessageType)1, hungerNotificationText.Value, 0, (Sprite)null, false); break; case notificationTypes.LargeCenter: MessageHud.instance.ShowMessage((MessageType)2, hungerNotificationText.Value, 0, (Sprite)null, false); break; } notificationTimer = 1f; } } private static void CheckPressedHideHud(bool pressedHideKey) { if (!pressedHideKey) { return; } hudHidden = !hudHidden; if (hudHiddenNotification.Value) { if (hudHidden) { MessageHud.instance.ShowMessage((MessageType)1, "Hud is hidden.", 0, (Sprite)null, false); } else { MessageHud.instance.ShowMessage((MessageType)1, "Hud is visible.", 0, (Sprite)null, false); } } string[] array = hudElementNames; foreach (string key in array) { hudElements[key].ResetTimers(); } } private static void CheckMinimapActive() { if (isMiniMapActive) { hudElements[GetMinimapElement()].targetAlpha = 0f; } else { hudElements[GetMinimapElement()].targetAlpha = 1f; } } private static void CheckPressedShowHud() { if (showHealthOnKeyPressed.Value) { hudElements[GetHealthbarElement()].ShowHudForDuration(); } if (showFoodBarOnKeyPressed.Value) { hudElements["BetterUI_FoodBar"].ShowHudForDuration(); hudElements["MUI_FoodBar"].ShowHudForDuration(); hudElements["food0"].ShowHudForDuration(); hudElements["food1"].ShowHudForDuration(); hudElements["food2"].ShowHudForDuration(); } if (showStaminaBarOnKeyPressed.Value) { hudElements[GetStaminabarElement()].ShowHudForDuration(); } if (showPowerOnKeyPressed.Value) { hudElements["GuardianPower"].ShowHudForDuration(); hudElements["MUI_GuardianPowerBar"].ShowHudForDuration(); } if (showHotKeyBarOnKeyPressed.Value) { hudElements["HotKeyBar"].ShowHudForDuration(); } if (showStatusEffectsOnKeyPressed.Value) { hudElements["StatusEffects"].ShowHudForDuration(); } if (showMiniMapOnKeyPressed.Value) { hudElements[GetMinimapElement()].ShowHudForDuration(); } if (showCompassOnKeyPressed.Value) { hudElements["Compass"].ShowHudForDuration(); } if (showTimeOnKeyPressed.Value && oryxenTimeEnabled.Value) { hudElements["DayTimePanel"].ShowHudForDuration(); } if (showQuickSlotsOnKeyPressed.Value) { hudElements[GetQuickslotElement()].ShowHudForDuration(); } if (showKeyHintsOnKeyPressed.Value) { hudElements["KeyHints"].ShowHudForDuration(); } } private static void CheckHealthBar(Player player) { string healthbarElement = GetHealthbarElement(); if (displayHealthAlways.Value || (displayHealthInInventory.Value && InventoryGui.IsVisible())) { hudElements[healthbarElement].targetAlpha = 1f; if (!displayHealthInInventory.Value && InventoryGui.IsVisible()) { hudElements[healthbarElement].HudSetTargetAlpha(0f); } } else if ((displayHealthWhenEating.Value && playerAteFood) || (displayHealthOnDamage.Value && playerTookDamage)) { hudElements[healthbarElement].ShowHudForDuration(); } else if ((displayHealthWhenBelow.Value && ((Character)player).GetHealthPercentage() <= healthPercentage.Value) || (displayHealthWhenFoodBelow.Value && playerFoodPercentage <= foodPercentage.Value) || (displayHealthWhenHungry.Value && playerHungerCount >= foodHungerAmount.Value)) { hudElements[healthbarElement].HudSetTargetAlpha(1f); } else { hudElements[healthbarElement].HudSetTargetAlpha(0f); } } private static void CheckFoodBar() { if (displayFoodBarAlways.Value || (displayFoodBarInInventory.Value && InventoryGui.IsVisible())) { hudElements["BetterUI_FoodBar"].targetAlpha = 1f; hudElements["MUI_FoodBar"].targetAlpha = 1f; hudElements["food0"].targetAlpha = 1f; hudElements["food1"].targetAlpha = 1f; hudElements["food2"].targetAlpha = 1f; if (!displayFoodBarInInventory.Value && InventoryGui.IsVisible()) { hudElements["BetterUI_FoodBar"].HudSetTargetAlpha(0f); hudElements["MUI_FoodBar"].HudSetTargetAlpha(0f); hudElements["food0"].HudSetTargetAlpha(0f); hudElements["food1"].HudSetTargetAlpha(0f); hudElements["food2"].HudSetTargetAlpha(0f); } } else if ((BetterUIEnabled.Value && hudElements["BetterUI_FoodBar"].exists) || (AzuMinimalUiEnabled.Value && hudElements["MUI_FoodBar"].exists)) { if (displayFoodBarWhenEating.Value && playerAteFood) { hudElements["BetterUI_FoodBar"].ShowHudForDuration(); hudElements["MUI_FoodBar"].ShowHudForDuration(); hudElements["food0"].ShowHudForDuration(); hudElements["food1"].ShowHudForDuration(); hudElements["food2"].ShowHudForDuration(); } if (displayFoodBarWhenBelow.Value && (playerFoodPercentage <= foodPercentage.Value || playerHungerCount >= foodHungerAmount.Value)) { hudElements["BetterUI_FoodBar"].HudSetTargetAlpha(1f); hudElements["MUI_FoodBar"].HudSetTargetAlpha(1f); hudElements["food0"].HudSetTargetAlpha(1f); hudElements["food1"].HudSetTargetAlpha(1f); hudElements["food2"].HudSetTargetAlpha(1f); } else { hudElements["BetterUI_FoodBar"].HudSetTargetAlpha(0f); hudElements["MUI_FoodBar"].HudSetTargetAlpha(0f); hudElements["food0"].HudSetTargetAlpha(0f); hudElements["food1"].HudSetTargetAlpha(0f); hudElements["food2"].HudSetTargetAlpha(0f); } } } private static void CheckStaminaBar(Player player) { string staminabarElement = GetStaminabarElement(); if (displayStaminaBarAlways.Value || (displayStaminaBarInInventory.Value && InventoryGui.IsVisible())) { hudElements[staminabarElement].targetAlpha = 1f; if (!displayStaminaBarInInventory.Value && InventoryGui.IsVisible()) { hudElements[staminabarElement].HudSetTargetAlpha(0f); } return; } if (displayStaminaBarOnUse.Value && playerUsedStamina) { hudElements[staminabarElement].ShowHudForDuration(); } if (displayStaminaBarWhenEating.Value && playerAteFood) { hudElements[staminabarElement].ShowHudForDuration(); } if ((displayStaminaBarWhenBelow.Value && ((Character)player).GetStaminaPercentage() <= staminaPercentage.Value) || (displayStaminaBarWhenFoodBelow.Value && playerFoodPercentage <= foodPercentage.Value) || (displayStaminaBarWhenHungry.Value && playerHungerCount >= foodHungerAmount.Value)) { hudElements[staminabarElement].HudSetTargetAlpha(1f); } else { hudElements[staminabarElement].HudSetTargetAlpha(0f); } } private static void CheckForsakenPower() { if (displayForsakenPowerAlways.Value || (displayPowerInInventory.Value && InventoryGui.IsVisible())) { hudElements["GuardianPower"].targetAlpha = 1f; hudElements["MUI_GuardianPowerBar"].targetAlpha = 1f; if (!displayPowerInInventory.Value && InventoryGui.IsVisible()) { hudElements["GuardianPower"].HudSetTargetAlpha(0f); } hudElements["MUI_GuardianPowerBar"].HudSetTargetAlpha(0f); } else { if (displayPowerOnActivation.Value && (ZInput.GetButtonDown("GPower") || ZInput.GetButtonDown("JoyGPower"))) { hudElements["GuardianPower"].ShowHudForDuration(); hudElements["MUI_GuardianPowerBar"].ShowHudForDuration(); } hudElements["GuardianPower"].HudSetTargetAlpha(0f); hudElements["MUI_GuardianPowerBar"].HudSetTargetAlpha(0f); } } private static void CheckHotbar() { if (displayHotKeyBarAlways.Value || (displayHotKeyBarInInventory.Value && InventoryGui.IsVisible())) { hudElements["HotKeyBar"].targetAlpha = 1f; if (!displayHotKeyBarInInventory.Value && InventoryGui.IsVisible()) { hudElements["HotKeyBar"].HudSetTargetAlpha(0f); } } else if (displayHotKeyBarOnItemSwitch.Value && playerUsedHotBarItem) { hudElements["HotKeyBar"].ShowHudForDuration(); } else if (displayHotKeyBarWhenItemEquipped.Value && playerHasItemEquipped) { hudElements["HotKeyBar"].HudSetTargetAlpha(1f); } else { hudElements["HotKeyBar"].HudSetTargetAlpha(0f); } } private static void CheckStatusEffect() { if (displayStatusEffectsAlways.Value || (displayStatusEffectsInInventory.Value && InventoryGui.IsVisible())) { hudElements["StatusEffects"].targetAlpha = 1f; if (!displayStatusEffectsInInventory.Value && InventoryGui.IsVisible()) { hudElements["StatusEffects"].HudSetTargetAlpha(0f); } } else { hudElements["StatusEffects"].HudSetTargetAlpha(0f); } } private static void CheckMinimap() { if (displayMiniMapAlways.Value || (displayMiniMapInInventory.Value && InventoryGui.IsVisible()) || !isMiniMapActive) { hudElements["MiniMap"].targetAlpha = 1f; hudElements["MUIMap"].targetAlpha = 1f; if (!displayMiniMapInInventory.Value && InventoryGui.IsVisible()) { hudElements["MiniMap"].HudSetTargetAlpha(0f); } hudElements["MUIMap"].HudSetTargetAlpha(0f); } else { hudElements["MiniMap"].HudSetTargetAlpha(0f); hudElements["MUIMap"].HudSetTargetAlpha(0f); } } private static void CheckKeyHints() { if (displayKeyHintsAlways.Value && hudElements["KeyHints"].exists) { hudElements["KeyHints"].targetAlpha = 1f; } else { hudElements["KeyHints"].HudSetTargetAlpha(0f); } } private static void CheckQuickSlots() { CheckRandyQuickSlots(); CheckAzuQuickSlots(); } private static string GetHealthbarElement() { if (AzuMinimalUiEnabled.Value && hudElements["MUI_HPBar"].exists) { return "MUI_HPBar"; } if (BetterUIEnabled.Value && hudElements["BetterUI_HPBar"].exists) { return "BetterUI_HPBar"; } return "healthpanel"; } private static string GetStaminabarElement() { if (AzuMinimalUiEnabled.Value && hudElements["MUI_StaminaBar"].exists) { return "MUI_StaminaBar"; } if (BetterUIEnabled.Value && hudElements["BetterUI_StaminaBar"].exists) { return "BetterUI_StaminaBar"; } return "staminapanel"; } private static string GetQuickslotElement() { if (AzuQuickSlotsEnabled.Value && hudElements["QuickAccessBar"].exists) { return "QuickAccessBar"; } if (RandyQuickSlotsEnabled.Value && hudElements["QuickSlotsHotkeyBar"].exists) { return "QuickSlotsHotkeyBar"; } return ""; } private static string GetMinimapElement() { if (hudElements["MUIMap"].exists) { return "MUIMap"; } if (hudElements["MiniMap"].exists) { return "MiniMap"; } return ""; } private static void CheckCompass() { if (!aedenCompassEnabled.Value || !hudElements["Compass"].exists) { return; } if (displayCompassAlways.Value || (displayCompassInInventory.Value && InventoryGui.IsVisible())) { hudElements["Compass"].targetAlpha = 1f; if (!displayCompassInInventory.Value && InventoryGui.IsVisible()) { hudElements["Compass"].HudSetTargetAlpha(0f); } } else { hudElements["Compass"].HudSetTargetAlpha(0f); } } private static void CheckDayTime() { if (!oryxenTimeEnabled.Value || !hudElements["DayTimePanel"].exists) { return; } if (displayTimeAlways.Value || (displayTimeInInventory.Value && InventoryGui.IsVisible())) { hudElements["DayTimePanel"].targetAlpha = 1f; if (!displayTimeInInventory.Value && InventoryGui.IsVisible()) { hudElements["DayTimePanel"].HudSetTargetAlpha(0f); } } else { hudElements["DayTimePanel"].HudSetTargetAlpha(0f); } } private static void CheckRandyQuickSlots() { if (!RandyQuickSlotsEnabled.Value || !hudElements["QuickSlotsHotkeyBar"].exists) { return; } if (displayQuickSlotsAlways.Value || (displayQuickSlotsInInventory.Value && InventoryGui.IsVisible())) { hudElements["QuickSlotsHotkeyBar"].targetAlpha = 1f; if (!displayQuickSlotsInInventory.Value && InventoryGui.IsVisible()) { hudElements["QuickSlotsHotkeyBar"].HudSetTargetAlpha(0f); } } else { hudElements["QuickSlotsHotkeyBar"].HudSetTargetAlpha(0f); } } private static void CheckAzuQuickSlots() { if (!AzuQuickSlotsEnabled.Value || !hudElements["QuickAccessBar"].exists) { return; } if (displayQuickSlotsAlways.Value || (displayQuickSlotsInInventory.Value && InventoryGui.IsVisible())) { hudElements["QuickAccessBar"].targetAlpha = 1f; if (!displayQuickSlotsInInventory.Value && InventoryGui.IsVisible()) { hudElements["QuickAccessBar"].HudSetTargetAlpha(0f); } } else { hudElements["QuickAccessBar"].HudSetTargetAlpha(0f); } } private static void CheckPlayerEquippedWeapon(ItemData playerEquippedWeapon) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 if (playerEquippedWeapon != null && (int)playerEquippedWeapon.m_shared.m_itemType == 4) { characterEquippedBow = true; characterEquippedItem = false; } else if (playerEquippedWeapon != null) { characterEquippedBow = false; characterEquippedItem = true; } else { characterEquippedItem = false; characterEquippedBow = false; } } private static void ResetPlayerTookDamage() { playerTookDamage = false; } private static void SetPlayerUsedStamina() { playerUsedStamina = false; } private static void SetPlayerAteFood() { playerAteFood = false; } private static void SetPlayerUsedHotBarItem() { playerUsedHotBarItem = false; } private static void SetPlayerStates() { SetPlayerUsedStamina(); SetPlayerAteFood(); SetPlayerUsedHotBarItem(); ResetPlayerTookDamage(); } public static void setCompatibilityInit() { hudElements["BetterUI_HPBar"].exists = false; hudElements["BetterUI_FoodBar"].exists = false; hudElements["BetterUI_StaminaBar"].exists = false; hudElements["Compass"].exists = false; hudElements["QuickSlotsHotkeyBar"].exists = false; hudElements["QuickAccessBar"].exists = false; hudElements["MUIMap"].exists = false; hudElements["MUI_HPBar"].exists = false; hudElements["MUI_StaminaBar"].exists = false; hudElements["MUI_EitrBar"].exists = false; hudElements["MUI_GuardianPowerBar"].exists = false; hudElements["MUI_FoodBar"].exists = false; hudElements["food0"].exists = false; hudElements["food1"].exists = false; hudElements["food2"].exists = false; } public static void setCompatibility(Transform hud) { if (BetterUIEnabled.Value && !hudElements["BetterUI_HPBar"].exists && Object.op_Implicit((Object)(object)hud.Find("BetterUI_HPBar"))) { hudElements["BetterUI_HPBar"].setElement(hud.Find("BetterUI_HPBar")); ((Component)((Component)hudElements["BetterUI_HPBar"].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); } if (BetterUIEnabled.Value && !hudElements["BetterUI_FoodBar"].exists && Object.op_Implicit((Object)(object)hud.Find("BetterUI_FoodBar"))) { hudElements["BetterUI_FoodBar"].setElement(hud.Find("BetterUI_FoodBar")); ((Component)((Component)hudElements["BetterUI_FoodBar"].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); } if (BetterUIEnabled.Value && !hudElements["BetterUI_StaminaBar"].exists && Object.op_Implicit((Object)(object)hud.Find("BetterUI_StaminaBar"))) { hudElements["BetterUI_StaminaBar"].setElement(hud.Find("BetterUI_StaminaBar")); ((Component)((Component)hudElements["BetterUI_StaminaBar"].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); } if (aedenCompassEnabled.Value && !hudElements["Compass"].exists && Object.op_Implicit((Object)(object)hud.Find("Compass"))) { hudElements["Compass"].setElement(hud.Find("Compass")); ((Component)((Component)hudElements["Compass"].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); } if (oryxenTimeEnabled.Value && !hudElements["DayTimePanel"].exists && Object.op_Implicit((Object)(object)hud.Find("DayTimePanel"))) { hudElements["DayTimePanel"].setElement(hud.Find("DayTimePanel")); ((Component)((Component)hudElements["DayTimePanel"].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); } if (RandyQuickSlotsEnabled.Value && !hudElements["QuickSlotsHotkeyBar"].exists && Object.op_Implicit((Object)(object)hud.Find("QuickSlotsHotkeyBar"))) { hudElements["QuickSlotsHotkeyBar"].setElement(hud.Find("QuickSlotsHotkeyBar")); ((Component)((Component)hudElements["QuickSlotsHotkeyBar"].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); } if (AzuQuickSlotsEnabled.Value && !hudElements["QuickAccessBar"].exists && Object.op_Implicit((Object)(object)hud.Find("QuickAccessBar"))) { hudElements["QuickAccessBar"].setElement(hud.Find("QuickAccessBar")); ((Component)((Component)hudElements["QuickAccessBar"].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); } if (AzuMinimalUiEnabled.Value) { if (AzuMinimalUiEnabled.Value && !hudElements["MUIMap"].exists && Object.op_Implicit((Object)(object)hud.Find("MUIMap"))) { hudElements["MUIMap"].setElement(hud.Find("MUIMap")); ((Component)((Component)hudElements["MUIMap"].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); } if (muiHealthbar.Value && !hudElements["MUI_HPBar"].exists && Object.op_Implicit((Object)(object)hud.Find("MUI_HPBar"))) { hudElements["MUI_HPBar"].setElement(hud.Find("MUI_HPBar")); ((Component)((Component)hudElements["MUI_HPBar"].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); } if (muiStaminabar.Value && !hudElements["MUI_StaminaBar"].exists && Object.op_Implicit((Object)(object)hud.Find("MUI_StaminaBar"))) { hudElements["MUI_StaminaBar"].setElement(hud.Find("MUI_StaminaBar")); ((Component)((Component)hudElements["MUI_StaminaBar"].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); } if (muiEitrbar.Value && !hudElements["MUI_EitrBar"].exists && Object.op_Implicit((Object)(object)hud.Find("MUI_EitrBar"))) { hudElements["MUI_EitrBar"].setElement(hud.Find("MUI_EitrBar")); ((Component)((Component)hudElements["MUI_EitrBar"].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); } if (muiPowerbar.Value && !hudElements["MUI_GuardianPowerBar"].exists && Object.op_Implicit((Object)(object)hud.Find("MUI_GuardianPowerBar"))) { hudElements["MUI_GuardianPowerBar"].setElement(hud.Find("MUI_GuardianPowerBar")); ((Component)((Component)hudElements["MUI_GuardianPowerBar"].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); } if (muiFoodbar.Value && !hudElements["MUI_FoodBar"].exists && Object.op_Implicit((Object)(object)hud.Find("MUI_FoodBar"))) { hudElements["MUI_FoodBar"].setElement(hud.Find("MUI_FoodBar")); ((Component)((Component)hudElements["MUI_FoodBar"].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); } if (muiFoodbox.Value && !hudElements["food0"].exists && Object.op_Implicit((Object)(object)hud.Find("food0"))) { hudElements["food0"].setElement(hud.Find("food0")); ((Component)((Component)hudElements["food0"].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); } if (muiFoodbox.Value && !hudElements["food1"].exists && Object.op_Implicit((Object)(object)hud.Find("food1"))) { hudElements["food1"].setElement(hud.Find("food1")); ((Component)((Component)hudElements["food1"].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); } if (muiFoodbox.Value && !hudElements["food2"].exists && Object.op_Implicit((Object)(object)hud.Find("food2"))) { hudElements["food2"].setElement(hud.Find("food2")); ((Component)((Component)hudElements["food2"].element).GetComponent<RectTransform>()).gameObject.AddComponent<CanvasGroup>(); } } } private void LoadConfig() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Expected O, but got Unknown //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Expected O, but got Unknown //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Expected O, but got Unknown //IL_05da: Unknown result type (might be due to invalid IL or missing references) //IL_05e4: Expected O, but got Unknown //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_0617: Unknown result type (might be due to invalid IL or missing references) //IL_0999: Unknown result type (might be due to invalid IL or missing references) //IL_09a3: Expected O, but got Unknown //IL_09d3: Unknown result type (might be due to invalid IL or missing references) //IL_09dd: Expected O, but got Unknown //IL_0a23: Unknown result type (might be due to invalid IL or missing references) //IL_0a2d: Expected O, but got Unknown //IL_0a4b: Unknown result type (might be due to invalid IL or missing references) //IL_0a55: Expected O, but got Unknown //IL_0a94: Unknown result type (might be due to invalid IL or missing references) //IL_0a9e: Expected O, but got Unknown //IL_0b8b: Unknown result type (might be due to invalid IL or missing references) //IL_0b91: Unknown result type (might be due to invalid IL or missing references) //IL_0bb1: Unknown result type (might be due to invalid IL or missing references) //IL_0bb7: Unknown result type (might be due to invalid IL or missing references) string text = "1.0 - General"; isEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Enable Mod", true, "Enable or disable the mod"); nexusID = ((BaseUnityPlugin)this).Config.Bind<int>(text, "NexusID", 2732, "Nexus mod ID for updates"); string text2 = "1.1 - Main settings"; showHudKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(text2, "1. Show HUD", new KeyboardShortcut((KeyCode)103, Array.Empty<KeyCode>()), "Keyboard shortcut or mouse button to display the hud for a duration."); hideHudKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(text2, "2. Hide HUD", new KeyboardShortcut((KeyCode)104, Array.Empty<KeyCode>()), "Keyboard shortcut or mouse button to hide the hud permanently."); hudHiddenNotification = ((BaseUnityPlugin)this).Config.Bind<bool>(text2, "3. Enable notification for HUD Hide-Show", true, "Enable notifications in the top left corner for hiding the hud."); hudFadeDuration = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "4. HUD fade duration", 1f, "How quickly the hud fades in or out."); showHudDuration = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "5. HUD shown duration", 1f, "How long a hud element should stay up for when it is activated for certain conditions."); string text3 = "2.0 - Always display"; displayHealthAlways = ((BaseUnityPlugin)this).Config.Bind<bool>(text3, "1. Health bar", false, "Always display the health panel."); displayStaminaBarAlways = ((BaseUnityPlugin)this).Config.Bind<bool>(text3, "2. Stamina bar", false, "Always display the stamina bar."); displayHotKeyBarAlways = ((BaseUnityPlugin)this).Config.Bind<bool>(text3, "3. Hotkey bar", false, "Always display the hotbar."); displayForsakenPowerAlways = ((BaseUnityPlugin)this).Config.Bind<bool>(text3, "4. Forsaken power", false, "Always display the forsaken power."); displayStatusEffectsAlways = ((BaseUnityPlugin)this).Config.Bind<bool>(text3, "5. Status effects", false, "Always display status effects."); displayKeyHintsAlways = ((BaseUnityPlugin)this).Config.Bind<bool>(text3, "6. Key hints", false, "Always display the key hints."); displayMiniMapAlways = ((BaseUnityPlugin)this).Config.Bind<bool>(text3, "7. Minimap", false, "Always display the minimap."); displayCrosshairAlways = ((BaseUnityPlugin)this).Config.Bind<bool>(text3, "8. Crosshair", true, "Always display the crosshair, overriding other display crosshair settings."); string text4 = "2.1 - Show on hotkey press"; showHealthOnKeyPressed = ((BaseUnityPlugin)this).Config.Bind<bool>(text4, "1. Health bar", true, "Show the health panel when the show hud key is pressed."); showStaminaBarOnKeyPressed = ((BaseUnityPlugin)this).Config.Bind<bool>(text4, "2. Stamina bar", true, "Show the stamina bar when the show hud key is pressed."); showPowerOnKeyPressed = ((BaseUnityPlugin)this).Config.Bind<bool>(text4, "3. Forsaken power", true, "Show the forsaken power when the show hud key is pressed."); showKeyHintsOnKeyPressed = ((BaseUnityPlugin)this).Config.Bind<bool>(text4, "4. Key hints", true, "Show the key hints when the show hud key is pressed."); showHotKeyBarOnKeyPressed = ((BaseUnityPlugin)this).Config.Bind<bool>(text4, "5. Hotkey bar", true, "Show the hot key bar when the show hud key is pressed."); showStatusEffectsOnKeyPressed = ((BaseUnityPlugin)this).Config.Bind<bool>(text4, "6. Status effects", true, "Show the status effects when the show hud key is pressed."); showMiniMapOnKeyPressed = ((BaseUnityPlugin)this).Config.Bind<bool>(text4, "7. Minimap", true, "Show the minimap when the show hud key is pressed."); string text5 = "3.0 - Healthbar"; displayHealthOnDamage = ((BaseUnityPlugin)this).Config.Bind<bool>(text5, "1. On damage", true, "Display the health panel when you take damage."); displayHealthInInventory = ((BaseUnityPlugin)this).Config.Bind<bool>(text5, "4. In inventory", true, "Display your health when in the inventory."); displayHealthWhenHungry = ((BaseUnityPlugin)this).Config.Bind<bool>(text5, "5. When hungry", false, "Display the health panel when you are hungry."); displayHealthWhenEating = ((BaseUnityPlugin)this).Config.Bind<bool>(text5, "6. When eating", false, "Display the health panel when you eat food."); displayHealthWhenBelow = ((BaseUnityPlugin)this).Config.Bind<bool>(text5, "7.1 When below health threshold", true, "When you are at or below a certain health percentage, display the health panel."); displayHealthWhenFoodBelow = ((BaseUnityPlugin)this).Config.Bind<bool>(text5, "7.2 When below food threshold", true, "When you are at or below a certain food percentage, display the health panel."); healthPercentage = ((BaseUnityPlugin)this).Config.Bind<float>(text5, "7.3 Health percentage", 0.75f, new ConfigDescription("Health percentage at which the health panel should be displayed", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); string text6 = "3.1 - Staminabar"; displayStaminaBarOnUse = ((BaseUnityPlugin)this).Config.Bind<bool>(text6, "1. On use", true, "Display the stamina bar when stamina is used, overrides stamina percentage."); displayStaminaBarInInventory = ((BaseUnityPlugin)this).Config.Bind<bool>(text6, "2. In inventory", true, "Display the stamina bar when in the inventory."); displayStaminaBarWhenHungry = ((BaseUnityPlugin)this).Config.Bind<bool>(text6, "3. When hungry", false, "Display the stamina bar when you are hungry."); displayStaminaBarWhenEating = ((BaseUnityPlugin)this).Config.Bind<bool>(text6, "4. When eating", true, "Display the stamina bar when you eat food."); displayStaminaBarWhenBelow = ((BaseUnityPlugin)this).Config.Bind<bool>(text6, "5. When below stamina threshold", true, "When you are at or below a certain stamina percentage, display the stamina bar."); staminaPercentage = ((BaseUnityPlugin)this).Config.Bind<float>(text6, "5.1 Stamina threshold", 0.99f, new ConfigDescription("Stamina percentage at which the stamina bar should be displayed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); displayStaminaBarWhenFoodBelow = ((BaseUnityPlugin)this).Config.Bind<bool>(text6, "6. When below food threshold", false, "When you are at or below a certain food percentage, display the stamina bar."); string text7 = "3.2 - Hotkey bar"; displayHotKeyBarInInventory = ((BaseUnityPlugin)this).Config.Bind<bool>(text7, "1. In inventory", true, "Display the hot key bar when in the inventory."); displayHotKeyBarOnItemSwitch = ((BaseUnityPlugin)this).Config.Bind<bool>(text7, "2. On item switch", false, "Display the hot key bar when you press any key for your hot bar items."); displayHotKeyBarWhenItemEquipped = ((BaseUnityPlugin)this).Config.Bind<bool>(text7, "3. On equipped item", false, "Display the hot key bar when you have an item equipped in either hand."); string text8 = "3.3 - Status Effects"; displayStatusEffectsInInventory = ((BaseUnityPlugin)this).Config.Bind<bool>(text8, "1. In inventory", true, "Display status effects when in the inventory."); string text9 = "3.4 - Forsaken Power"; displayPowerInInventory = ((BaseUnityPlugin)this).Config.Bind<bool>(text9, "1. In inventory", true, "Display the forsaken power when in the inventory."); displayPowerOnActivation = ((BaseUnityPlugin)this).Config.Bind<bool>(text9, "2. On activation", false, "Display the forsaken power when the key to use it is pressed."); string text10 = "3.5 Minimap"; displayMiniMapInInventory = ((BaseUnityPlugin)this).Config.Bind<bool>(text10, "1. In inventory", true, "Display the minimap when in the inventory."); string text11 = "3.6 Crosshair"; useCustomCrosshair = ((BaseUnityPlugin)this).Config.Bind<bool>(text11, "1. Use custom crosshair", false, new ConfigDescription("Enable or disable the new crosshair.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 1 } })); useCustomBowCrosshair = ((BaseUnityPlugin)this).Config.Bind<bool>(text11, "1.1 Use custom Bow crosshair", false, new ConfigDescription("Enable or disable the new crosshair for the bow draw.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 2 } })); crosshairColor = ((BaseUnityPlugin)this).Config.Bind<Color>(text11, "2. Color", Color.white, "Color and transparency of the crosshair."); crosshairBowDrawColor = ((BaseUnityPlugin)this).Config.Bind<Color>(text11, "2.1 Bow Draw crosshair color", Color.yellow, "Color and transparency of the bow draw crosshair."); displayBowDrawCrosshair = ((BaseUnityPlugin)this).Config.Bind<bool>(text11, "3. Show bow draw crosshair", true, "Display the bow draw crosshair."); displayCrosshairWhenBuilding = ((BaseUnityPlugin)this).Config.Bind<bool>(text11, "4. Show while building", true, "Display the crosshair when you have the hammer equipped."); displayCrosshairOnActivation = ((BaseUnityPlugin)this).Config.Bind<bool>(text11, "5. Show on object-hover", false, "Display crosshair when hovering over an activatable object."); displayCrosshairOnEquipped = ((BaseUnityPlugin)this).Config.Bind<bool>(text11, "6. Show on equipped item", false, "Display crosshair when an item is equipped in either hand."); displayCrosshairOnBowEquipped = ((BaseUnityPlugin)this).Config.Bind<bool>(text11, "7. Show on equipped bow", false, "Display crosshair when the bow is equipped."); disableStealthHud = ((BaseUnityPlugin)this).Config.Bind<bool>(text11, "8. Disable stealth hud", false, "Disable the stealth bar and indicator so it doesn't display."); disableCrosshairStamina = ((BaseUnityPlugin)this).Config.Bind<bool>(text11, "9. Hide the crosshair staminabar", false, ""); string text12 = "4.0 - Compatibility"; AzuMinimalUiEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(text12, "1. Minimal UI", false, "Enable compatibility for Azumatt's MinimalUI mod."); AzuQuickSlotsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(text12, "2. AzuExtendedPlayerInventory", false, "Enable compatibility for Azumatt's ExtendedPlayerInventory mod."); RandyQuickSlotsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(text12, "3. Equipment and Quick Slots", false, "Enable compatibility for quickslots mod."); aedenCompassEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(text12, "4. Compass", false, "Enable compatibility for aedenthorn's compass mod."); BetterUIEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(text12, "5. BetterUI", false, "Enable compatibility for Better UI."); oryxenTimeEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(text12, "6. Display Day and Time in HUD", false, "Enable compatibility for oryxen's display day and time mod."); string text13 = "4.1 - Compatibility: Quickslots"; displayQuickSlotsInInventory = ((BaseUnityPlugin)this).Config.Bind<bool>(text13, "1. In inventory", false, "Display quick slots when in the inventory."); showQuickSlotsOnKeyPressed = ((BaseUnityPlugin)this).Config.Bind<bool>(text13, "2. On key pressed", false, "Show the quick slots when the show hud key is pressed."); displayQuickSlotsAlways = ((BaseUnityPlugin)this).Config.Bind<bool>(text13, "3. Always display", false, "Always display the quick slots (Requires [AzuExtendedInventory] or [Equipment and Quick Slots])."); string text14 = "4.2 - Compatibility: Day and Time"; displayTimeInInventory = ((BaseUnityPlugin)this).Config.Bind<bool>(text14, "1. In inventory", false, "Display the time when in the inventory."); showTimeOnKeyPressed = ((BaseUnityPlugin)this).Config.Bind<bool>(text14, "2. On key pressed", false, "Show the time when the show hud key is pressed."); displayTimeAlways = ((BaseUnityPlugin)this).Config.Bind<bool>(text14, "3. Always display", false, "Always display the time or clock (Requires oryxen's display day and time mod)."); string text15 = "4.3 - Compatibility: Compass"; displayCompassInInventory = ((BaseUnityPlugin)this).Config.Bind<bool>(text15, "1. In inventory", false, "Display the compass when in the inventory."); showCompassOnKeyPressed = ((BaseUnityPlugin)this).Config.Bind<bool>(text15, "2. On key pressed", false, "Show the compass when the show hud key is pressed."); displayCompassAlways = ((BaseUnityPlugin)this).Config.Bind<bool>(text15, "3. Always", false, "Always display the compass (Requires aedenthorn's compass)."); string text16 = "4.4 - Compatibility: Food bar"; displayFoodBarAlways = ((BaseUnityPlugin)this).Config.Bind<bool>(text16, "1. Show always", false, "Always display the food bar (Requires Better UI or MinimalUI)."); showFoodBarOnKeyPressed = ((BaseUnityPlugin)this).Config.Bind<bool>(text16, "2. On Show HUD hotkey", true, "Display the food bar when the show hud key is pressed."); displayFoodBarInInventory = ((BaseUnityPlugin)this).Config.Bind<bool>(text16, "3. In inventory", true, "Display the food bar when in the inventory."); displayFoodBarWhenHungry = ((BaseUnityPlugin)this).Config.Bind<bool>(text16, "4. When hungry", true, "Display the food bar when you are hungry."); displayFoodBarWhenEating = ((BaseUnityPlugin)this).Config.Bind<bool>(text16, "5. When eating", true, "Display the food bar when you eat food."); displayFoodBarWhenBelow = ((BaseUnityPlugin)this).Config.Bind<bool>(text16, "6. When below threshold", true, "When you are at or below a certain food percentage, display the food bar."); foodHungerAmount = ((BaseUnityPlugin)this).Config.Bind<int>(text16, "6.1 Hunger threshold", 3, new ConfigDescription("The minimum amount of food icons that need to be flashing to be considered hungry.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 3), Array.Empty<object>())); foodPercentage = ((BaseUnityPlugin)this).Config.Bind<float>(text16, "6.2 Food threshold", 0.35f, new ConfigDescription("Food percentage at which the food bar, health, or stamina should be displayed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); hungerNotification = ((BaseUnityPlugin)this).Config.Bind<bool>(text16, "hungerNotification", false, "Enable notifications for when you are hungry."); hungerNotificationInterval = ((BaseUnityPlugin)this).Config.Bind<int>(text16, "hungerNotificationInterval", 25, new ConfigDescription("How often the notification should display in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(5, 180), Array.Empty<object>())); hungerNotificationOption = ((BaseUnityPlugin)this).Config.Bind<hungerNotificationOptions>(text16, "hungerNotificationOption", hungerNotificationOptions.FoodPercentage, new ConfigDescription("Option to be used for notifications.", (AcceptableValueBase)null, Array.Empty<object>())); hungerNotificationText = ((BaseUnityPlugin)this).Config.Bind<string>(text16, "hungerNotificationText", "I'm feeling a bit peckish.", "Message for hunger notification."); hungerNotificationType = ((BaseUnityPlugin)this).Config.Bind<notificationTypes>(text16, "hungerNotificationType", notificationTypes.SmallTopLeft, new ConfigDescription("Notification types for the hunger notification.", (AcceptableValueBase)null, Array.Empty<object>())); string text17 = "4.5 - Compatibility: Minimal UI"; muiHealthbar = ((BaseUnityPlugin)this).Config.Bind<bool>(text17, "1. Enable MinimalUI Health bar", true, "Has to be enabled/disabled in both mods"); muiStaminabar = ((BaseUnityPlugin)this).Config.Bind<bool>(text17, "2. Enable MinimalUI Stamina bar", true, "Has to be enabled/disabled in both mods"); muiEitrbar = ((BaseUnityPlugin)this).Config.Bind<bool>(text17, "3. Enable MinimalUI Eitr bar", true, "Has to be enabled/disabled in both mods"); muiPowerbar = ((BaseUnityPlugin)this).Config.Bind<bool>(text17, "4. Enable MinimalUI Guardian Power bar", true, "Has to be enabled/disabled in both mods"); muiFoodbar = ((BaseUnityPlugin)this).Config.Bind<bool>(text17, "5. Enable MinimalUI Food bar", true, "Has to be enabled/disabled in both mods"); muiFoodbox = ((BaseUnityPlugin)this).Config.Bind<bool>(text17, "6. Enable MinimalUI Food boxes", true, "Has to be enabled/disabled in both mods"); string text18 = "9.0 - Misc"; hudHiddenOnStart = ((BaseUnityPlugin)this).Config.Bind<bool>(text18, "9.1 Hide HUD on start", false, "Hide the hud when the game is started."); compatibilityIdHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(text18, "9.2 Prints missing UI elements to the console", default(KeyboardShortcut), "Debug purposes"); listAllElementsHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(text18, "9.3 Prints all available UI elements to the console", default(KeyboardShortcut), "Debug purposes"); } private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("jwlei.ImmersiveHud"); LoadConfig(); if (!isEnabled.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Immersive Hud is disabled in the mod config"); val.UnpatchSelf(); } else { val.PatchAll(); } } private void OnDestroy() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("jwlei.ImmersiveHud"); val.UnpatchSelf(); } }