Decompiled source of GeekEasy Optional v1.1.6
BepInEx/plugins/MarsarahTweaks.dll
Decompiled 20 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using JetBrains.Annotations; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using MarsarahTweaks.Managers; using MarsarahTweaks.Patches.Balance; using MarsarahTweaks.Patches.BuildPieces; using MarsarahTweaks.Patches.Features; using MarsarahTweaks.Patches.Grind; using MarsarahTweaks.Patches.QOL; using MarsarahTweaks.Patches.UI; using Microsoft.CodeAnalysis; using ServerSync; using Splatform; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MarsarahTweaks")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MarsarahTweaks")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("831fc141-e3fa-4e67-9d2f-5e56cf6f3935")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace MarsarahTweaks { [BepInPlugin("Marsarah.MarsarahTweaks", "MarsarahTweaks", "1.4.2")] public class MarsarahTweaks : BaseUnityPlugin { internal const string ModName = "MarsarahTweaks"; internal const string ModVersion = "1.4.2"; internal const string Author = "Marsarah"; public const string ModGUID = "Marsarah.MarsarahTweaks"; private readonly Harmony harmony = new Harmony("Marsarah.MarsarahTweaks"); private void Awake() { LogManager.SetGlobalLogLevel(LogManager.LogLevel.Warning); ConfigManager.Init(((BaseUnityPlugin)this).Config); UISmartBiome.UpdateBiomeWeights(); harmony.PatchAll(); } private void Update() { UIController.UpdateUIDisplay(); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } } } namespace MarsarahTweaks.Patches { public static class GlobalKeyChecker { [HarmonyPatch(typeof(ZoneSystem), "Update")] private class BossStatusUpdate_Patch { private static void Postfix(ZoneSystem __instance) { UpdateDefeatedStates(__instance); EikthyrDefeated = CheckGlobalKey("defeated_eikthyr"); ElderDefeated = CheckGlobalKey("defeated_gdking"); BonemassDefeated = CheckGlobalKey("defeated_bonemass"); ModerDefeated = CheckGlobalKey("defeated_dragon"); YagluthDefeated = CheckGlobalKey("defeated_goblinking"); QueenDefeated = CheckGlobalKey("defeated_queen"); FaderDefeated = CheckGlobalKey("defeated_fader"); BrennaDefeated = CheckGlobalKey("hildir1"); GeirrhafaDefeated = CheckGlobalKey("hildir2"); ThungrNZilDefeated = CheckGlobalKey("hildir3"); } } private static readonly LogManager log = new LogManager("Global Key Checker", LogManager.LogLevel.Warning); public static bool EikthyrDefeated = false; public static bool ElderDefeated = false; public static bool BonemassDefeated = false; public static bool ModerDefeated = false; public static bool YagluthDefeated = false; public static bool QueenDefeated = false; public static bool FaderDefeated = false; public static bool BrennaDefeated = false; public static bool GeirrhafaDefeated = false; public static bool ThungrNZilDefeated = false; private static readonly Dictionary<string, bool> globalKeyStates = new Dictionary<string, bool> { { "defeated_eikthyr", false }, { "defeated_gdking", false }, { "defeated_bonemass", false }, { "defeated_dragon", false }, { "defeated_goblinking", false }, { "defeated_queen", false }, { "defeated_fader", false }, { "hildir1", false }, { "hildir2", false }, { "hildir3", false } }; private static readonly Dictionary<string, string> bossToGlobalKey = new Dictionary<string, string> { { "Eikthyr", "defeated_eikthyr" }, { "The Elder", "defeated_gdking" }, { "Bonemass", "defeated_bonemass" }, { "Moder", "defeated_dragon" }, { "Yagluth", "defeated_goblinking" }, { "The Queen", "defeated_queen" }, { "Fader", "defeated_fader" }, { "Brenna", "hildir1" }, { "Geirrhafa", "hildir2" }, { "ThungrNZil", "hildir3" } }; private static void UpdateDefeatedStates(ZoneSystem zoneSystem) { List<string> globalKeys = zoneSystem.GetGlobalKeys(); foreach (string item in globalKeyStates.Keys.ToList()) { bool flag = globalKeys.Contains(item); if (globalKeyStates[item] != flag) { globalKeyStates[item] = flag; } } } private static bool CheckGlobalKey(string globalKey) { if (globalKeyStates.ContainsKey(globalKey)) { return globalKeyStates[globalKey]; } return false; } public static bool IsBossDefeated(string boss) { if (bossToGlobalKey.TryGetValue(boss, out var value)) { return CheckGlobalKey(value); } log.Warn("IsBossDefeated called with unknown boss: " + boss); return false; } } } namespace MarsarahTweaks.Patches.UI { internal class UIAshlandsHeatLevel : UIController { [HarmonyPatch(typeof(Character), "UpdateLava")] public class GetHeatLevel_Patch { private static void Postfix(Character __instance, ref float ___m_lavaHeatLevel) { if ((!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated()) && ConfigManager.ShowHeatLevelInAshlands.Value && UIController.showUI && __instance is Player) { heatThreshold = __instance.m_heatLevelFirstDamageThreshold; currentHeat = ___m_lavaHeatLevel; } } } [HarmonyPatch(typeof(Hud), "Awake")] private class InventoryWeightAndSlots_HUDAwakePatch { private static void Postfix(Hud __instance) { if ((!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated()) && !((Object)(object)__instance == (Object)null) && ConfigManager.ShowInventoryWeightAndSlots.Value) { CreateUI(__instance); } } } [HarmonyPatch(typeof(Hud), "Update")] private static class HeatLevelHUDUpdate_Patch { private static void Postfix(Hud __instance) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Invalid comparison between Unknown and I4 //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) if (((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsDedicated()) || (Object)(object)__instance == (Object)null) { return; } if (ConfigManager.ShowHeatLevelInAshlands.Value) { CreateUI(__instance); if (!Object.op_Implicit((Object)(object)Player.m_localPlayer) || !((Object)(object)heatBarFill != (Object)null) || !(heatThreshold > 0f)) { return; } if ((int)Player.m_localPlayer.GetCurrentBiome() != 32) { if ((Object)(object)UIHeatBarArea != (Object)null && UIHeatBarArea.activeSelf) { UIHeatBarArea.SetActive(false); } return; } bool flag = !IsUIHidden() && !IsLoadScreenActive(__instance); if (UIHeatBarArea.activeSelf != flag) { UIHeatBarArea.SetActive(flag); } heatBarFill.fillAmount = Mathf.Clamp01(currentHeat / heatThreshold); if ((Object)(object)heatBarText != (Object)null) { float num = Mathf.Clamp01(currentHeat / heatThreshold) * 100f; heatBarText.text = $"{num:0}%"; } float fillAmount = heatBarFill.fillAmount; Color yellow = Color.yellow; Color val = default(Color); ((Color)(ref val))..ctor(1f, 0.549019f, 0f); Color red = Color.red; Color color = ((fillAmount < 0.5f) ? Color.Lerp(yellow, val, fillAmount * 2f) : Color.Lerp(val, red, (fillAmount - 0.5f) * 2f)); if (fillAmount > 0.8f) { float a = 0.6f + 0.4f * Mathf.Sin(Time.time * 4f); color.a = a; } else { color.a = 0.8f; } ((Graphic)heatBarFill).color = color; if (heatBarFill.fillAmount == 0f) { if ((Object)(object)heatBarFill != (Object)null) { ((Behaviour)heatBarFill).enabled = false; } if ((Object)(object)heatBarBGImage != (Object)null) { ((Behaviour)heatBarBGImage).enabled = false; } if ((Object)(object)heatBarText != (Object)null) { ((Behaviour)heatBarText).enabled = false; } if ((Object)(object)heatBarEmojiTMP != (Object)null) { ((Behaviour)heatBarEmojiTMP).enabled = false; ((TMP_Text)heatBarEmojiTMP).text = ""; } } else { if ((Object)(object)heatBarFill != (Object)null) { ((Behaviour)heatBarFill).enabled = UIController.showUI; } if ((Object)(object)heatBarBGImage != (Object)null) { ((Behaviour)heatBarBGImage).enabled = UIController.showUI; } if ((Object)(object)heatBarText != (Object)null) { ((Behaviour)heatBarText).enabled = UIController.showUI; } if ((Object)(object)heatBarEmojiTMP != (Object)null) { ((Behaviour)heatBarEmojiTMP).enabled = UIController.showUI; ((TMP_Text)heatBarEmojiTMP).text = "\ud83d\udd25"; } } } else { if ((Object)(object)heatBarFill != (Object)null) { ((Behaviour)heatBarFill).enabled = false; } if ((Object)(object)heatBarBGImage != (Object)null) { ((Behaviour)heatBarBGImage).enabled = false; } if ((Object)(object)heatBarText != (Object)null) { ((Behaviour)heatBarText).enabled = false; } if ((Object)(object)heatBarEmojiTMP != (Object)null) { ((Behaviour)heatBarEmojiTMP).enabled = false; } } } private static Sprite GenerateWhiteSprite() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, Color.white); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f)); } private static bool IsLoadScreenActive(Hud hud) { if (Object.op_Implicit((Object)(object)Hud.instance) && Object.op_Implicit((Object)(object)hud.m_loadingScreen)) { return ((Component)hud.m_loadingScreen).gameObject.activeSelf; } return false; } private static bool IsUIHidden() { return Hud.IsUserHidden(); } } private static readonly LogManager log = new LogManager("UI Ashlands Heat", LogManager.LogLevel.Warning); private static Image heatBarFill = null; private static Image heatBarBGImage = null; private static GameObject UIHeatBarArea = null; private static Text heatBarText = null; private static TextMeshProUGUI heatBarEmojiTMP = null; private static float heatThreshold; private static float currentHeat; private static void CreateUI(Hud hud) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0081: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00e9: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)UIHeatBarArea != (Object)null)) { Vector2 sizeDelta = default(Vector2); ((Vector2)(ref sizeDelta))..ctor(200f, 25f); int fontSize = 13; int fontSize2 = 10; string fontName = "AveriaSansLibre-Bold"; string fontName2 = "NotoEmoji-Regular SDF"; UIHeatBarArea = new GameObject("HeatBar"); UIHeatBarArea.layer = 5; UIHeatBarArea.transform.SetParent(hud.m_rootObject.transform.parent, false); RectTransform obj = UIHeatBarArea.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0.5f, 0.5f); obj.anchorMax = new Vector2(0.5f, 0.5f); obj.pivot = new Vector2(0.5f, 0.5f); obj.anchoredPosition = new Vector2(0f, 350f); obj.sizeDelta = sizeDelta; UIHeatBarArea.transform.localScale = Vector3.one; GameObject val = new GameObject("HeatBarBackground"); val.transform.SetParent(UIHeatBarArea.transform, false); heatBarBGImage = val.AddComponent<Image>(); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; ((Graphic)heatBarBGImage).color = new Color(0f, 0f, 0f, 0.4f); ((Behaviour)heatBarBGImage).enabled = false; GameObject val2 = new GameObject("HeatBarFill"); val2.transform.SetParent(UIHeatBarArea.transform, false); heatBarFill = val2.AddComponent<Image>(); RectTransform component2 = val2.GetComponent<RectTransform>(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = new Vector2(3f, 3f); component2.offsetMax = new Vector2(-3f, -3f); Sprite sprite = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).FirstOrDefault((Func<Sprite, bool>)((Sprite s) => ((Object)s).name == "bar_monster_hp_5")); heatBarFill.sprite = sprite; heatBarFill.type = (Type)3; heatBarFill.fillMethod = (FillMethod)0; heatBarFill.fillOrigin = 0; heatBarFill.fillAmount = 0f; ((Behaviour)heatBarFill).enabled = false; heatBarText = UIController.CreateTextObject("HeatText", UIHeatBarArea, Color.white, fontName, fontSize, (TextAnchor)4, new Vector2(0f, 0f), sizeDelta); heatBarEmojiTMP = UIController.CreateTMPTextObject("HeatEmojiTMP", UIHeatBarArea, Color.red, fontName2, fontSize2, (TextAlignmentOptions)4100, new Vector2(-2f, 0f), sizeDelta, log); } } } internal class UIBoatSpeed : UIController { [HarmonyPatch(typeof(Ship), "GetSpeed")] private class ShowBoatSpeed_Patch { private static void Prefix(Ship __instance, ref Rigidbody ___m_body) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if ((!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated()) && ConfigManager.ShowBoatSpeed.Value) { if (Object.op_Implicit((Object)(object)__instance) && __instance.HasPlayerOnboard()) { boatSpeed = Vector3.Dot(___m_body.linearVelocity, ((Component)__instance).transform.forward); } if (Traverse.Create((object)__instance).Method("HaveControllingPlayer", Array.Empty<object>()).GetValue<bool>()) { showBoatSpeedUI = true; } else { showBoatSpeedUI = false; } } } } [HarmonyPatch(typeof(Hud), "Awake")] private class InventoryWeightAndSlots_HUDAwakePatch { private static void Postfix(Hud __instance) { if ((!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated()) && !((Object)(object)__instance == (Object)null) && ConfigManager.ShowInventoryWeightAndSlots.Value) { CreateTextBasedUI(__instance); CreateSymbolBasedUI(__instance); } } } [HarmonyPatch(typeof(Hud), "Update")] private static class BoatSpeedHUDUpdate_Patch { private static void Postfix(Hud __instance) { //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsDedicated()) || (Object)(object)__instance == (Object)null) { return; } if (ConfigManager.ShowBoatSpeed.Value) { CreateTextBasedUI(__instance); CreateSymbolBasedUI(__instance); if (!ConfigManager.UseSymbolsForUI.Value) { GameObject uIBoatArea = UIBoatArea; if (uIBoatArea != null) { uIBoatArea.SetActive(showBoatSpeedUI && UIController.showUI); } GameObject uIBoatArea2 = UIBoatArea2; if (uIBoatArea2 != null) { uIBoatArea2.SetActive(false); } if (showBoatSpeedUI && UIController.showUI) { ((Graphic)UIBoatText).color = GetColorFromSpeed(boatSpeed); UIBoatText.text = ((boatSpeed > 0f) ? boatSpeed.ToString("0.00") : ("R " + Math.Abs(boatSpeed).ToString("0.00"))); UIBoatTextTitle.text = "Boat speed"; } } else { GameObject uIBoatArea3 = UIBoatArea; if (uIBoatArea3 != null) { uIBoatArea3.SetActive(false); } GameObject uIBoatArea4 = UIBoatArea2; if (uIBoatArea4 != null) { uIBoatArea4.SetActive(showBoatSpeedUI && UIController.showUI); } if (showBoatSpeedUI && UIController.showUI) { ((Graphic)UIBoatText2).color = GetColorFromSpeed(boatSpeed); UIBoatText2.text = ((boatSpeed > 0f) ? boatSpeed.ToString("0.00") : ("R " + Math.Abs(boatSpeed).ToString("0.00"))); ((TMP_Text)UIBoatEmojiTMP).text = "⛵"; } } } else { CreateTextBasedUI(__instance); CreateSymbolBasedUI(__instance); GameObject uIBoatArea5 = UIBoatArea; if (uIBoatArea5 != null) { uIBoatArea5.SetActive(false); } GameObject uIBoatArea6 = UIBoatArea2; if (uIBoatArea6 != null) { uIBoatArea6.SetActive(false); } } } private static Color GetColorFromSpeed(float speed) { //IL_0008: 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_0039: 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) if (speed < 2.5f) { return Color.red; } if (speed < 5f) { return new Color(1f, 0.549019f, 0f); } if (speed < 7.5f) { return Color.yellow; } return Color.green; } } private static readonly LogManager log = new LogManager("UI Boat Speed", LogManager.LogLevel.Warning); private static float boatSpeed; private static bool showBoatSpeedUI; internal static GameObject UIBoatArea = null; private static Text UIBoatText = null; private static Text UIBoatTextTitle = null; internal static GameObject UIBoatArea2 = null; private static Text UIBoatText2 = null; private static TextMeshProUGUI UIBoatEmojiTMP = null; private static void CreateTextBasedUI(Hud hud) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_01a4: 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_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)UIBoatArea != (Object)null) || !((Object)(object)UIBoatText != (Object)null) || !((Object)(object)UIBoatTextTitle != (Object)null)) { int fontSize = 16; string fontName = "AveriaSansLibre-Bold"; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(155f, 30f); Vector2 sizeDelta = default(Vector2); if (!ConfigManager.UseSymbolsForUI.Value) { sizeDelta = val; } else { ((Vector2)(ref sizeDelta))..ctor(155f, 30f); } UIBoatArea = new GameObject("BoatArea"); UIBoatArea.layer = 5; UIBoatArea.transform.SetParent(((Component)hud.m_healthPanel).transform); RectTransform obj = UIBoatArea.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(1f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.anchoredPosition = new Vector2((ConfigManager.ShowInventoryWeightAndSlots.Value && ConfigManager.ShowEnemyDetector.Value) ? 203f : ((ConfigManager.ShowInventoryWeightAndSlots.Value || ConfigManager.ShowEnemyDetector.Value) ? 100f : (-40f)), -230f); obj.sizeDelta = sizeDelta; UIBoatArea.transform.localScale = Vector3.one; Sprite sprite = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).FirstOrDefault((Func<Sprite, bool>)((Sprite tempSprite) => ((Object)tempSprite).name == "InputFieldBackground")); Image obj2 = UIBoatArea.AddComponent<Image>(); ((Graphic)obj2).color = new Color(0f, 0f, 0f, 0.4f); obj2.sprite = sprite; obj2.type = (Type)1; UIBoatTextTitle = UIController.CreateTextObject("BoatTextTitle", UIBoatArea, Color.white, fontName, fontSize, (TextAnchor)4, new Vector2(-25f, 0f), val); UIBoatText = UIController.CreateTextObject("BoatText", UIBoatArea, Color.white, fontName, fontSize, (TextAnchor)4, new Vector2(45f, 0f), sizeDelta); } } private static void CreateSymbolBasedUI(Hud hud) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)UIBoatArea2 != (Object)null) || !((Object)(object)UIBoatText2 != (Object)null) || !((Object)(object)UIBoatEmojiTMP != (Object)null)) { int num = 16; string fontName = "AveriaSansLibre-Bold"; string fontName2 = "NotoEmoji-Regular SDF"; Vector2 sizeDelta = default(Vector2); ((Vector2)(ref sizeDelta))..ctor(80f, 30f); float num2 = (Game.m_noMap ? (-145f) : (-283f)); float num3 = -225f; if (AppDomain.CurrentDomain.GetAssemblies().Any((Assembly a) => a.GetName().Name == "MinimalStatusEffects")) { num2 = -360f; num3 = -25f; } UIBoatArea2 = new GameObject("BoatArea2"); UIBoatArea2.layer = 5; UIBoatArea2.transform.SetParent(hud.m_rootObject.transform); RectTransform obj = UIBoatArea2.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(1f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.anchoredPosition = new Vector2(num2, num3); obj.sizeDelta = sizeDelta; UIBoatArea2.transform.localScale = Vector3.one; UIBoatText2 = UIController.CreateTextObject("BoatText2", UIBoatArea2, Color.white, fontName, num, (TextAnchor)5, new Vector2(-4f, 0f), sizeDelta); UIBoatEmojiTMP = UIController.CreateTMPTextObject("BoatEmojiTMP", UIBoatArea2, Color.white, fontName2, num + 4, (TextAlignmentOptions)4097, new Vector2(4f, 0f), sizeDelta, log); } } } internal class UIBossPowerExpiration { [HarmonyPatch(typeof(StatusEffect), "Stop")] public class StatusEffectStopPatch { public static void Postfix(StatusEffect __instance) { if (!ConfigManager.ShowBossExpirationMessage.Value) { return; } Character character = __instance.m_character; if (!((Object)(object)character == (Object)null) && character.IsPlayer() && character.IsOwner()) { string name = ((Object)__instance).name; log.Info("SE Name: " + name); if (name.Contains("GP_")) { string text = Localization.instance.Localize(__instance.m_name); character.Message((MessageType)2, text + " Power Expired", 0, (Sprite)null); } } } } private static readonly LogManager log = new LogManager("UI Boss Power Expire", LogManager.LogLevel.Warning); } internal class UIController { [HarmonyPatch(typeof(Hud), "Awake")] private static class HudAwakePatch { private static void Prefix() { TMP_FontAsset val = ((IEnumerable<TMP_FontAsset>)Resources.FindObjectsOfTypeAll<TMP_FontAsset>()).FirstOrDefault((Func<TMP_FontAsset, bool>)((TMP_FontAsset f) => ((Object)f).name == "NotoEmoji-Regular SDF")); if ((Object)(object)val != (Object)null) { TMP_Settings.defaultFontAsset = val; log.Info("Set default TMP font asset to NotoEmoji-Regular SDF"); } else { log.Warn("NotoEmoji font not found."); } } } private static readonly LogManager log = new LogManager("UI Controller", LogManager.LogLevel.Warning); public static bool showUI = true; public static bool showPlayerList = true; public static void LogAllTMPFonts() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); if (array.Length == 0) { Debug.LogWarning((object)"[TMPDebug] No TMP_FontAssets found in memory!"); return; } Debug.Log((object)$"[TMPDebug] {array.Length} TMP_FontAssets found in memory:"); foreach (TMP_FontAsset item in array.OrderBy((TMP_FontAsset f) => ((Object)f).name)) { string text = (((Object)(object)item != (Object)null) ? $"name: '{((Object)item).name}', hideFlags: {((Object)item).hideFlags}" : "null font"); Debug.Log((object)("[TMPDebug] " + text)); } } public static void UpdateUIDisplay() { if (Input.GetKeyDown((KeyCode)277)) { showUI = !showUI; } if (Input.GetKeyDown((KeyCode)278)) { showPlayerList = !showPlayerList; } } public static Text CreateTextObject(string name, GameObject parent, Color textColor, string fontName, int fontSize, TextAnchor alignment, Vector2 position, Vector2 sizeDelta) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name) { layer = 5 }; val.transform.SetParent(parent.transform); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchoredPosition = position; obj.sizeDelta = sizeDelta; ((Transform)obj).localScale = Vector3.one; Text val2 = val.AddComponent<Text>(); ((Graphic)val2).color = textColor; val2.font = ((IEnumerable<Font>)Resources.FindObjectsOfTypeAll<Font>()).FirstOrDefault((Func<Font, bool>)((Font f) => ((Object)f).name == fontName)); val2.fontSize = fontSize; val2.alignment = alignment; Outline obj2 = val.AddComponent<Outline>(); ((Shadow)obj2).effectColor = Color.black; ((Shadow)obj2).effectDistance = new Vector2(1f, -1f); ((Shadow)obj2).useGraphicAlpha = true; ((MonoBehaviour)obj2).useGUILayout = true; return val2; } public static TextMeshProUGUI CreateTMPTextObject(string name, GameObject parent, Color textColor, string fontName, int fontSize, TextAlignmentOptions alignment, Vector2 position, Vector2 sizeDelta, LogManager specificLog) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0033: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name) { layer = 5 }; val.transform.SetParent(parent.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchoredPosition = position; obj.sizeDelta = sizeDelta; ((Transform)obj).localScale = Vector3.one; TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); ((Graphic)val2).color = textColor; ((TMP_Text)val2).font = ((IEnumerable<TMP_FontAsset>)Resources.FindObjectsOfTypeAll<TMP_FontAsset>()).FirstOrDefault((Func<TMP_FontAsset, bool>)((TMP_FontAsset f) => ((Object)f).name == fontName)); ((TMP_Text)val2).fontSize = fontSize; ((TMP_Text)val2).alignment = alignment; ((TMP_Text)val2).text = ""; if ((Object)(object)((TMP_Text)val2).font != (Object)null) { object obj2 = val2; obj2 = ((!((Object)(object)((TMP_Text)val2).fontMaterial != (Object)null)) ? ((object)((TMP_Asset)((TMP_Text)val2).font).material) : ((object)new Material(((TMP_Text)val2).fontMaterial))); ((TMP_Text)obj2).fontMaterial = (Material)obj2; if (((TMP_Text)val2).fontMaterial.HasProperty(ShaderUtilities.ID_OutlineWidth) && ((TMP_Text)val2).fontMaterial.HasProperty(ShaderUtilities.ID_OutlineColor)) { ((TMP_Text)val2).fontMaterial.SetFloat(ShaderUtilities.ID_OutlineWidth, 0.125f); ((TMP_Text)val2).fontMaterial.SetColor(ShaderUtilities.ID_OutlineColor, Color.black); } ((TMP_Text)val2).havePropertiesChanged = true; ((Graphic)val2).SetAllDirty(); ((TMP_Text)val2).ForceMeshUpdate(false, false); } else { specificLog.Warn("Font material for '" + fontName + "' is null or font is missing. Skipping outline setup."); } return val2; } public static void UpdateUIPositions() { //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) if (!ConfigManager.UseSymbolsForUI.Value) { float num = -45f; float num2 = -230f; bool num3 = (Object)(object)UIInventoryWeightAndSlots.UIInventoryArea != (Object)null && ConfigManager.ShowInventoryWeightAndSlots.Value; bool flag = (Object)(object)UIEnemyDetector.UIEnemyArea != (Object)null && ConfigManager.ShowEnemyDetector.Value; bool flag2 = (Object)(object)UIBoatSpeed.UIBoatArea != (Object)null && ConfigManager.ShowBoatSpeed.Value; if (num3) { num += 115f; if (!flag && flag2) { num += 30f; } } if (flag) { UIEnemyDetector.UIEnemyArea.GetComponent<RectTransform>().anchoredPosition = new Vector2(num, num2); num += 133f; } if (flag2) { UIBoatSpeed.UIBoatArea.GetComponent<RectTransform>().anchoredPosition = new Vector2(num, num2); } } else { float num4 = -10f; float num5 = -230f; bool num6 = (Object)(object)UIInventoryWeightAndSlots.UIWeightBarArea != (Object)null && (Object)(object)UIInventoryWeightAndSlots.UISlotsArea != (Object)null && ConfigManager.ShowInventoryWeightAndSlots.Value; bool flag3 = (Object)(object)UIEnemyDetector.UIEnemyArea2 != (Object)null && (Object)(object)UIEnemyDetector.UIFriendlyArea != (Object)null && ConfigManager.ShowEnemyDetector.Value; if (num6) { num4 += 132f; } else if (flag3) { num4 -= 55f; } if (flag3) { UIEnemyDetector.UIEnemyArea2.GetComponent<RectTransform>().anchoredPosition = new Vector2(num4, num5); UIEnemyDetector.UIFriendlyArea.GetComponent<RectTransform>().anchoredPosition = new Vector2(num4 + 54f, num5); } } } } internal class UIEnemyDetector : UIController { [HarmonyPatch(typeof(Player), "Update")] private class EnemyDetector_PlayerPatch { private static void Prefix(ref Player ___m_localPlayer) { //IL_0045: 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_0073: Invalid comparison between Unknown and I4 if (((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsDedicated()) || (Object)(object)___m_localPlayer == (Object)null || !ConfigManager.ShowEnemyDetector.Value) { return; } int num = 0; int num2 = 0; List<Character> list = new List<Character>(); Character.GetCharactersInRange(((Component)___m_localPlayer).transform.position, 30f, list); foreach (Character item in list) { if ((int)item.GetFaction() == 10 && (Object)(object)item.GetBaseAI() != (Object)null && !item.GetBaseAI().IsAggravated()) { num2++; } if (item.m_name.ToString() == "Human" || item.m_name.ToString() == "$enemy_deer" || item.m_name.ToString() == "$enemy_hare" || item.m_name.ToString() == "$enemy_summonedroot" || item.IsTamed()) { num++; } } numEnemies = list.Count - num - num2; numEnemiesPassive = num2; } } [HarmonyPatch(typeof(Hud), "Awake")] private class InventoryWeightAndSlots_HUDAwakePatch { private static void Postfix(Hud __instance) { if ((!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated()) && !((Object)(object)__instance == (Object)null) && ConfigManager.ShowInventoryWeightAndSlots.Value) { CreateTextBasedUI(__instance); CreateSymbolBasedUI(__instance); } } } [HarmonyPatch(typeof(Hud), "Update")] private class EnemyDetector_HUDUpdatePatch { private static bool lastUseSymbolInsteadOfWords = ConfigManager.UseSymbolsForUI.Value; private static void Postfix(Hud __instance) { //IL_0169: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) if (((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsDedicated()) || (Object)(object)__instance == (Object)null) { return; } if (ConfigManager.ShowEnemyDetector.Value) { CreateTextBasedUI(__instance); CreateSymbolBasedUI(__instance); if (!ConfigManager.UseSymbolsForUI.Value) { GameObject uIEnemyArea = UIEnemyArea; if (uIEnemyArea != null) { uIEnemyArea.SetActive(UIController.showUI); } GameObject uIEnemyArea2 = UIEnemyArea2; if (uIEnemyArea2 != null) { uIEnemyArea2.SetActive(false); } GameObject uIFriendlyArea = UIFriendlyArea; if (uIFriendlyArea != null) { uIFriendlyArea.SetActive(false); } if (UIController.showUI) { ((Graphic)UIEnemyText).color = GetColorFromNum(numEnemies); if (numEnemiesPassive > 0) { UIEnemyText.text = "Enemies " + numEnemies + " (" + numEnemiesPassive + ")"; } else { UIEnemyText.text = "Enemies " + numEnemies; } } return; } GameObject uIEnemyArea3 = UIEnemyArea; if (uIEnemyArea3 != null) { uIEnemyArea3.SetActive(false); } GameObject uIEnemyArea4 = UIEnemyArea2; if (uIEnemyArea4 != null) { uIEnemyArea4.SetActive(UIController.showUI); } GameObject uIFriendlyArea2 = UIFriendlyArea; if (uIFriendlyArea2 != null) { uIFriendlyArea2.SetActive(UIController.showUI && numEnemiesPassive != 0); } if (UIController.showUI) { Color colorFromNum = GetColorFromNum(numEnemies); ((Graphic)UIEnemyText2).color = colorFromNum; UIEnemyText2.text = numEnemies.ToString(); ((Graphic)UIEnemyEmojiTMP).color = colorFromNum; if (numEnemies == 0) { ((TMP_Text)UIEnemyEmojiTMP).text = "\ud83d\udc41"; } else if (numEnemies < 5) { ((TMP_Text)UIEnemyEmojiTMP).text = "\ud83d\ude08"; } else if (numEnemies < 7) { ((TMP_Text)UIEnemyEmojiTMP).text = "\ud83d\udc7f"; } else { ((TMP_Text)UIEnemyEmojiTMP).text = "☠"; } Color colorFromNum2 = GetColorFromNum(numEnemiesPassive); ((Graphic)UIFriendlyText).color = colorFromNum2; UIFriendlyText.text = numEnemiesPassive.ToString(); ((Graphic)UIFriendlyEmojiTMP).color = colorFromNum2; ((TMP_Text)UIFriendlyEmojiTMP).text = "\ud83e\uddd4\u200d"; } } else { CreateTextBasedUI(__instance); CreateSymbolBasedUI(__instance); GameObject uIEnemyArea5 = UIEnemyArea; if (uIEnemyArea5 != null) { uIEnemyArea5.SetActive(false); } GameObject uIEnemyArea6 = UIEnemyArea2; if (uIEnemyArea6 != null) { uIEnemyArea6.SetActive(false); } GameObject uIFriendlyArea3 = UIFriendlyArea; if (uIFriendlyArea3 != null) { uIFriendlyArea3.SetActive(false); } } } private static Color GetColorFromNum(int num) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0027: Unknown result type (might be due to invalid IL or missing references) if (num < 3) { return Color.green; } if (num < 5) { return Color.yellow; } if (num < 7) { return new Color(1f, 0.549019f, 0f); } return Color.red; } } private static readonly LogManager log = new LogManager("UI Enemy Detector", LogManager.LogLevel.Warning); public static int numEnemies; public static int numEnemiesPassive; internal static GameObject UIEnemyArea = null; private static Text UIEnemyText = null; internal static GameObject UIEnemyArea2 = null; private static Text UIEnemyText2 = null; private static TextMeshProUGUI UIEnemyEmojiTMP = null; internal static GameObject UIFriendlyArea = null; private static Text UIFriendlyText = null; private static TextMeshProUGUI UIFriendlyEmojiTMP = null; private static void CreateTextBasedUI(Hud hud) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)UIEnemyArea != (Object)null) || !((Object)(object)UIEnemyText != (Object)null)) { int fontSize = 16; string fontName = "AveriaSansLibre-Bold"; Vector2 sizeDelta = default(Vector2); ((Vector2)(ref sizeDelta))..ctor(100f, 30f); UIEnemyArea = new GameObject("EnemyArea"); UIEnemyArea.layer = 5; UIEnemyArea.transform.SetParent(((Component)hud.m_healthPanel).transform); RectTransform obj = UIEnemyArea.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(1f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.anchoredPosition = new Vector2(ConfigManager.ShowInventoryWeightAndSlots.Value ? 70f : (-40f), -230f); obj.sizeDelta = sizeDelta; UIEnemyArea.transform.localScale = Vector3.one; Sprite sprite = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).FirstOrDefault((Func<Sprite, bool>)((Sprite tempSprite) => ((Object)tempSprite).name == "InputFieldBackground")); Image obj2 = UIEnemyArea.AddComponent<Image>(); ((Graphic)obj2).color = new Color(0f, 0f, 0f, 0.4f); obj2.sprite = sprite; obj2.type = (Type)1; UIEnemyText = UIController.CreateTextObject("EnemyText", UIEnemyArea, Color.white, fontName, fontSize, (TextAnchor)4, new Vector2(0f, 0f), sizeDelta); } } private static void CreateSymbolBasedUI(Hud hud) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Expected O, but got Unknown //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: 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_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)UIEnemyArea2 != (Object)null) || !((Object)(object)UIEnemyText2 != (Object)null) || !((Object)(object)UIEnemyEmojiTMP != (Object)null)) { int num = 16; string fontName = "AveriaSansLibre-Bold"; string fontName2 = "NotoEmoji-Regular SDF"; Vector2 sizeDelta = default(Vector2); ((Vector2)(ref sizeDelta))..ctor(50f, 30f); float num2 = (ConfigManager.ShowInventoryWeightAndSlots.Value ? 122f : (-65f)); float num3 = -230f; UIEnemyArea2 = new GameObject("EnemyArea2"); UIEnemyArea2.layer = 5; UIEnemyArea2.transform.SetParent(((Component)hud.m_healthPanel).transform); RectTransform obj = UIEnemyArea2.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(1f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.anchoredPosition = new Vector2(num2, num3); obj.sizeDelta = sizeDelta; UIEnemyArea2.transform.localScale = Vector3.one; Sprite sprite = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).FirstOrDefault((Func<Sprite, bool>)((Sprite tempSprite) => ((Object)tempSprite).name == "InputFieldBackground")); Image obj2 = UIEnemyArea2.AddComponent<Image>(); ((Graphic)obj2).color = new Color(0f, 0f, 0f, 0.4f); obj2.sprite = sprite; obj2.type = (Type)1; UIEnemyText2 = UIController.CreateTextObject("EnemyText2", UIEnemyArea2, Color.white, fontName, num, (TextAnchor)5, new Vector2(-4f, 0f), sizeDelta); UIEnemyEmojiTMP = UIController.CreateTMPTextObject("EnemyEmojiTMP", UIEnemyArea2, Color.green, fontName2, num + 4, (TextAlignmentOptions)4097, new Vector2(4f, 0f), sizeDelta, log); UIFriendlyArea = new GameObject("FriendlyArea"); UIFriendlyArea.layer = 5; UIFriendlyArea.transform.SetParent(((Component)hud.m_healthPanel).transform); num2 += 54f; RectTransform obj3 = UIFriendlyArea.AddComponent<RectTransform>(); obj3.anchorMin = new Vector2(1f, 1f); obj3.anchorMax = new Vector2(1f, 1f); obj3.anchoredPosition = new Vector2(num2, num3); obj3.sizeDelta = sizeDelta; UIFriendlyArea.transform.localScale = Vector3.one; ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).FirstOrDefault((Func<Sprite, bool>)((Sprite tempSprite) => ((Object)tempSprite).name == "InputFieldBackground")); Image obj4 = UIFriendlyArea.AddComponent<Image>(); ((Graphic)obj4).color = new Color(0f, 0f, 0f, 0.4f); obj4.sprite = sprite; obj4.type = (Type)1; UIFriendlyText = UIController.CreateTextObject("FriendlyText", UIFriendlyArea, Color.white, fontName, num, (TextAnchor)5, new Vector2(-4f, 0f), sizeDelta); UIFriendlyEmojiTMP = UIController.CreateTMPTextObject("FriendlyEmojiTMP", UIFriendlyArea, Color.green, fontName2, num + 4, (TextAlignmentOptions)4097, new Vector2(4f, 0f), sizeDelta, log); } } } internal class UIInventoryWeightAndSlots : UIController { [HarmonyPatch(typeof(Player), "Update")] private class InventoryWeightAndSlots_PlayerPatch { private static void Prefix(ref Player ___m_localPlayer) { if ((!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated()) && !((Object)(object)___m_localPlayer == (Object)null) && ConfigManager.ShowInventoryWeightAndSlots.Value) { currentWeight = ((Humanoid)___m_localPlayer).GetInventory().GetTotalWeight(); maxWeight = ___m_localPlayer.GetMaxCarryWeight(); freeSlots = ((Humanoid)___m_localPlayer).GetInventory().GetEmptySlots(); freeSlotsPercent = ((Humanoid)___m_localPlayer).GetInventory().SlotsUsedPercentage(); } } } [HarmonyPatch(typeof(Hud), "Awake")] private class InventoryWeightAndSlots_HUDAwakePatch { private static void Postfix(Hud __instance) { if ((!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated()) && !((Object)(object)__instance == (Object)null) && ConfigManager.ShowInventoryWeightAndSlots.Value) { CreateTextBasedUI(__instance); CreateSymbolBasedUI(__instance); } } } [HarmonyPatch(typeof(Hud), "Update")] private class InventoryWeightAndSlots_HUDUpdatePatch { private static void Postfix(Hud __instance) { //IL_01b1: 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_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) if (((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsDedicated()) || (Object)(object)__instance == (Object)null) { return; } if (ConfigManager.ShowInventoryWeightAndSlots.Value) { CreateTextBasedUI(__instance); CreateSymbolBasedUI(__instance); if (!ConfigManager.UseSymbolsForUI.Value) { GameObject uIInventoryArea = UIInventoryArea; if (uIInventoryArea != null) { uIInventoryArea.SetActive(UIController.showUI); } GameObject uIWeightBarArea = UIWeightBarArea; if (uIWeightBarArea != null) { uIWeightBarArea.SetActive(false); } GameObject uIWeightBarEmojiArea = UIWeightBarEmojiArea; if (uIWeightBarEmojiArea != null) { uIWeightBarEmojiArea.SetActive(false); } GameObject uISlotsArea = UISlotsArea; if (uISlotsArea != null) { uISlotsArea.SetActive(false); } if (UIController.showUI) { float percent = currentWeight * 100f / maxWeight; ((Graphic)UIWeightText).color = GetColorFromPercent(percent); UIWeightText.text = currentWeight.ToString("0.0") + "/" + maxWeight.ToString("0"); } if (UIController.showUI) { ((Graphic)UISlotText).color = GetColorFromPercent(freeSlotsPercent); UISlotText.text = "(" + freeSlots + ")"; } return; } GameObject uIInventoryArea2 = UIInventoryArea; if (uIInventoryArea2 != null) { uIInventoryArea2.SetActive(false); } GameObject uIWeightBarArea2 = UIWeightBarArea; if (uIWeightBarArea2 != null) { uIWeightBarArea2.SetActive(UIController.showUI); } GameObject uIWeightBarEmojiArea2 = UIWeightBarEmojiArea; if (uIWeightBarEmojiArea2 != null) { uIWeightBarEmojiArea2.SetActive(UIController.showUI); } GameObject uISlotsArea2 = UISlotsArea; if (uISlotsArea2 != null) { uISlotsArea2.SetActive(UIController.showUI); } if (UIController.showUI) { weightBarFill.fillAmount = Mathf.Clamp01(currentWeight / maxWeight); Color colorBlendFromPercent = GetColorBlendFromPercent(weightBarFill.fillAmount); ((Graphic)weightBarFill).color = colorBlendFromPercent; if ((Object)(object)UIWeightBarText != (Object)null) { UIWeightBarText.text = currentWeight.ToString("0.0") + "/" + maxWeight.ToString("0"); } if ((Object)(object)UIWeightBarEmojiTMP != (Object)null) { ((TMP_Text)UIWeightBarEmojiTMP).text = "\ud83c\udfcb\ufe0f"; ((Graphic)UIWeightBarEmojiTMP).color = colorBlendFromPercent; } Color colorFromPercent = GetColorFromPercent(freeSlotsPercent); if ((Object)(object)UISlotsText2 != (Object)null) { ((Graphic)UISlotsText2).color = colorFromPercent; UISlotsText2.text = freeSlots.ToString(); } if ((Object)(object)UISlotsEmojiTMP != (Object)null) { ((Graphic)UISlotsEmojiTMP).color = colorFromPercent; ((TMP_Text)UISlotsEmojiTMP).text = "\ud83c\udf92"; } } } else { CreateTextBasedUI(__instance); CreateSymbolBasedUI(__instance); GameObject uIInventoryArea3 = UIInventoryArea; if (uIInventoryArea3 != null) { uIInventoryArea3.SetActive(false); } GameObject uIWeightBarArea3 = UIWeightBarArea; if (uIWeightBarArea3 != null) { uIWeightBarArea3.SetActive(false); } GameObject uIWeightBarEmojiArea3 = UIWeightBarEmojiArea; if (uIWeightBarEmojiArea3 != null) { uIWeightBarEmojiArea3.SetActive(false); } GameObject uISlotsArea3 = UISlotsArea; if (uISlotsArea3 != null) { uISlotsArea3.SetActive(false); } } } private static Color GetColorFromPercent(float percent) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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) if (percent < 33f) { return Color.green; } if (percent < 66f) { return Color.yellow; } if (percent < 100f) { return new Color(1f, 0.549019f, 0f); } return Color.red; } private static Color GetColorBlendFromPercent(float percent) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_0072: 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_0085: Unknown result type (might be due to invalid IL or missing references) Color green = Color.green; Color green2 = Color.green; Color yellow = Color.yellow; Color val = default(Color); ((Color)(ref val))..ctor(1f, 0.549019f, 0f); Color red = Color.red; if (percent <= 0.33f) { return Color.Lerp(green, green2, percent / 0.33f); } if (percent <= 0.66f) { return Color.Lerp(green2, yellow, (percent - 0.33f) / 0.33f); } if (percent < 1f) { return Color.Lerp(yellow, val, (percent - 0.66f) / 0.34f); } return red; } } private static readonly LogManager log = new LogManager("UI Inventory", LogManager.LogLevel.Warning); private static float currentWeight; private static float maxWeight; private static float freeSlots; private static float freeSlotsPercent; internal static GameObject UIInventoryArea = null; private static Text UIWeightText = null; private static Text UISlotText = null; internal static GameObject UIWeightBarArea = null; private static GameObject UIWeightBarEmojiArea = null; private static Image weightBarFill = null; private static Text UIWeightBarText = null; private static TextMeshProUGUI UIWeightBarEmojiTMP = null; internal static GameObject UISlotsArea = null; private static Text UISlotsText2 = null; private static TextMeshProUGUI UISlotsEmojiTMP = null; private static void CreateTextBasedUI(Hud hud) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)UIInventoryArea != (Object)null) || !((Object)(object)UIWeightText != (Object)null) || !((Object)(object)UISlotText != (Object)null)) { int fontSize = 16; string fontName = "AveriaSansLibre-Bold"; Vector2 sizeDelta = default(Vector2); ((Vector2)(ref sizeDelta))..ctor(115f, 30f); UIInventoryArea = new GameObject("InventoryArea"); UIInventoryArea.layer = 5; UIInventoryArea.transform.SetParent(((Component)hud.m_healthPanel).transform); RectTransform obj = UIInventoryArea.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(1f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.anchoredPosition = new Vector2(-45f, -230f); obj.sizeDelta = sizeDelta; UIInventoryArea.transform.localScale = Vector3.one; Sprite sprite = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).FirstOrDefault((Func<Sprite, bool>)((Sprite tempSprite) => ((Object)tempSprite).name == "InputFieldBackground")); Image obj2 = UIInventoryArea.AddComponent<Image>(); ((Graphic)obj2).color = new Color(0f, 0f, 0f, 0.4f); obj2.sprite = sprite; obj2.type = (Type)1; UIWeightText = UIController.CreateTextObject("WeightText", UIInventoryArea, Color.green, fontName, fontSize, (TextAnchor)3, new Vector2(5f, 0f), sizeDelta); UISlotText = UIController.CreateTextObject("SlotText", UIInventoryArea, Color.green, fontName, fontSize, (TextAnchor)5, new Vector2(-5f, 0f), sizeDelta); } } private static void CreateSymbolBasedUI(Hud hud) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Expected O, but got Unknown //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Expected O, but got Unknown //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)UIWeightBarArea != (Object)null)) { int num = 16; string fontName = "AveriaSansLibre-Bold"; string fontName2 = "NotoEmoji-Regular SDF"; Vector2 sizeDelta = default(Vector2); ((Vector2)(ref sizeDelta))..ctor(100f, 30f); Vector2 sizeDelta2 = default(Vector2); ((Vector2)(ref sizeDelta2))..ctor(30f, 30f); float num2 = -10f; float num3 = -230f; UIWeightBarArea = new GameObject("WeightAreaBar"); UIWeightBarArea.layer = 5; UIWeightBarArea.transform.SetParent(((Component)hud.m_healthPanel).transform); RectTransform obj = UIWeightBarArea.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(1f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.anchoredPosition = new Vector2(num2, num3); obj.sizeDelta = sizeDelta; UIWeightBarArea.transform.localScale = Vector3.one; GameObject val = new GameObject("WeightBarBackground"); val.transform.SetParent(UIWeightBarArea.transform, false); Image val2 = val.AddComponent<Image>(); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; ((Graphic)val2).color = new Color(0f, 0f, 0f, 0.4f); GameObject val3 = new GameObject("WeightBarFill"); val3.transform.SetParent(UIWeightBarArea.transform, false); weightBarFill = val3.AddComponent<Image>(); RectTransform component2 = val3.GetComponent<RectTransform>(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = new Vector2(3f, 3f); component2.offsetMax = new Vector2(-3f, -3f); Sprite sprite = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).FirstOrDefault((Func<Sprite, bool>)((Sprite s) => ((Object)s).name == "bar_monster_hp_5")); weightBarFill.sprite = sprite; weightBarFill.type = (Type)3; weightBarFill.fillMethod = (FillMethod)0; weightBarFill.fillOrigin = 0; weightBarFill.fillAmount = 0f; UIWeightBarEmojiArea = new GameObject("WeightAreaEmoji"); UIWeightBarEmojiArea.layer = 5; UIWeightBarEmojiArea.transform.SetParent(((Component)hud.m_healthPanel).transform); num2 -= 65f; RectTransform obj2 = UIWeightBarEmojiArea.AddComponent<RectTransform>(); obj2.anchorMin = new Vector2(1f, 1f); obj2.anchorMax = new Vector2(1f, 1f); obj2.anchoredPosition = new Vector2(num2, num3); obj2.sizeDelta = sizeDelta2; UIWeightBarEmojiArea.transform.localScale = Vector3.one; GameObject val4 = new GameObject("WeightEmojiBackground"); val4.transform.SetParent(UIWeightBarEmojiArea.transform, false); Image val5 = val4.AddComponent<Image>(); RectTransform component3 = val4.GetComponent<RectTransform>(); component3.anchorMin = Vector2.zero; component3.anchorMax = Vector2.one; component3.offsetMin = Vector2.zero; component3.offsetMax = Vector2.zero; ((Graphic)val5).color = new Color(0f, 0f, 0f, 0.4f); UIWeightBarText = UIController.CreateTextObject("WeightText", UIWeightBarArea, Color.white, fontName, num, (TextAnchor)4, new Vector2(0f, 0f), sizeDelta); UIWeightBarEmojiTMP = UIController.CreateTMPTextObject("WeightEmojiTMP", UIWeightBarEmojiArea, Color.green, fontName2, num + 4, (TextAlignmentOptions)4098, new Vector2(0f, 0f), sizeDelta, log); Vector2 sizeDelta3 = default(Vector2); ((Vector2)(ref sizeDelta3))..ctor(50f, 30f); num2 = 68f; UISlotsArea = new GameObject("SlotsArea"); UISlotsArea.layer = 5; UISlotsArea.transform.SetParent(((Component)hud.m_healthPanel).transform); RectTransform obj3 = UISlotsArea.AddComponent<RectTransform>(); obj3.anchorMin = new Vector2(1f, 1f); obj3.anchorMax = new Vector2(1f, 1f); obj3.anchoredPosition = new Vector2(num2, num3); obj3.sizeDelta = sizeDelta3; UISlotsArea.transform.localScale = Vector3.one; Sprite sprite2 = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).FirstOrDefault((Func<Sprite, bool>)((Sprite tempSprite) => ((Object)tempSprite).name == "InputFieldBackground")); Image obj4 = UISlotsArea.AddComponent<Image>(); ((Graphic)obj4).color = new Color(0f, 0f, 0f, 0.4f); obj4.sprite = sprite2; obj4.type = (Type)1; UISlotsText2 = UIController.CreateTextObject("slotsText", UISlotsArea, Color.white, fontName, num, (TextAnchor)5, new Vector2(-4f, 0f), sizeDelta3); UISlotsEmojiTMP = UIController.CreateTMPTextObject("SlotsEmojiTMP", UISlotsArea, Color.green, fontName2, num + 4, (TextAlignmentOptions)4097, new Vector2(4f, 0f), sizeDelta3, log); } } } internal class UILoadscreenTips { [HarmonyPatch(typeof(Localization), "SetupLanguage")] private class LoadingTips_Patch { private static void Postfix(Localization __instance, string language) { if ((!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated()) && __instance != null && ConfigManager.MoreLoadingTipsEnabled.Value) { localizationLanguage = language; } } } [HarmonyPatch(typeof(Hud), "Awake")] private class Loadscreens_HUDAwakePatch { private static void Postfix(Hud __instance) { if ((!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated()) && !((Object)(object)__instance == (Object)null) && ConfigManager.MoreLoadingTipsEnabled.Value) { loadingTipString = loadingTipStrings[Random.Range(0, loadingTipStrings.Count)]; } } } [HarmonyPatch(typeof(Hud), "UpdateBlackScreen")] private class ExtraLoadingTipsUpdate_Patch { private static void Postfix(Hud __instance) { if ((!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated()) && !((Object)(object)__instance == (Object)null) && ConfigManager.MoreLoadingTipsEnabled.Value && localizationLanguage == "English") { __instance.m_loadingTip.text = loadingTipString; } } } private static readonly LogManager log = new LogManager("UI Loadscreen", LogManager.LogLevel.Warning); private static string loadingTipString; private static string localizationLanguage; private static readonly List<string> loadingTipStrings = new List<string> { "Weapons and armor can be crafted and upgraded using Workbenches or Forges.", "Eating food increases your health and stamina pools. Try to balance your three food slots accordingly.", "Crafting stations can be upgraded by building extenstions in their proximity.", "There are four principal crafting types: woodworking, masonry, smithing, and cooking.", "Enemies won't spawn near player built structures, such as crafting tables and camp fires.", "Sitting is the safest way to travel while on a boat.", "Upon your arrival in Valheim, try to find stones and branches on the ground to build your first weapon.", "Venturing outside at night is more dangerous. Be prepared if you plan to go out during that time.", "Hunting deer with a ranged weapon provides a good source of meat and skin.", "Build a rudimentary shelter as soon as possible, to refuge during your first nights. It can be used as a temporary home until you find a good spot for a better one.", "Different enemies are resistant to different damage types. If you see grey damage indicators when attacking, try changing the weapon.", "Claiming a bed after building it will set your spawn point to its location when dying.", "Attacking with knives and bows while sneaking confers a large damage bonus.", "Birds are a good source of feathers. They will stay close to the ground while the weather is bad.", "Weapons, armor, and tools can be repaired for free at a Workbench or Forge by interacting with the hammer icon while crafting.", "Some resources require better tools to harvest them.", "Being rested helps to regenerate stamina and health faster.", "Yellow damage numbers indicate a weakness, grey numbers indicate a resistance", "Use the hoe in combination with the pickaxe to flatten the ground. This will make it much easier to construct buildings.", "Build a cart to haul heavy goods over longer distances. Carts cannot go through portals.", "Boats are controlled by interacting with the steering oar.", "Defeating a Forsaken will drop items that will give you a general idea of what to do next.", "Cooking meat over a fire or eating fruit is a good way to get fed. Later on, they can be cooked using a cauldron.", "You can filter map pins by type by right clicking on them. (DPad Right)", "If no arrow has been manually selected when using a bow, arrows are automatically selected in ascending order beginning from the leftmost column and going right.", "Build a Fermenter to craft different potions from base meads. The right potion used at the right time and place can be the difference between life and death.", "Killing bee nests can provide the means to make your own honey.", "The more comfort items are installed in your home (e.g., fire, rugs, furniture, etc), the longer the rested bonus will be.", "When fighting a Forsaken, make sure you bring your best gear, food, and potions.", "All build pieces require a certain crafting station nearby (e.g., Workbench, Forge, Stonecutter). If you want to build outside their range, either move them closer or build new ones.", "Building paths and roads can make carying material with a cart a lot easier.", "Item stacks can be split using SHIFT + Left Click in chests or inventory.", "Item stacks can be fully transferred to/from containers by dragging or pressing CTRL + Left Click.", "If you run out of stamina while swimming, you will drown.", "The HUD can be toggled with the CTRL + F3 keys.", "Parying with a shield or weapon means blocking at the very last moment of an enemy attack before hitting you. If done right, the enemy will be staggered.", "Don't be afraid to retreat from a fight. It is better to come back to it prepared than naked.", "Sheathing or unsheathing equipped weapons and shields can be done by pressing R. Walking and runnng with unsheathed weapons will slow you down.", "Old buildings can be found throughout Valheim. They can be either renovated for shelter, or torn down for resources.", "Some animals can be tamed.", "Sitting next to a lit fire in any open space provides a level 1 rested bonus." }; } internal static class PlayerLogoutAnnounce { [HarmonyPatch(typeof(ZNet), "Update")] public static class ZNet_Update_Patch { public static void Postfix() { if (!Object.op_Implicit((Object)(object)ZNet.instance) || !ZNet.instance.IsServer() || !ConfigManager.AnnouncePlayerLogout.Value) { return; } List<ZNetPeer> connectedPeers = ZNet.instance.GetConnectedPeers(); HashSet<string> hashSet = new HashSet<string>(); foreach (ZNetPeer item in connectedPeers) { if (!string.IsNullOrEmpty(item.m_playerName)) { hashSet.Add(item.m_playerName); } } foreach (string previousPeer in _previousPeers) { if (!hashSet.Contains(previousPeer)) { log.Info(previousPeer + " logged out."); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "MarsarahTweaks_LogoutAnnounce", new object[1] { previousPeer }); } } _previousPeers = hashSet; } } [HarmonyPatch(typeof(ZNetScene), "Awake")] public static class ZNet_Awake_LogoutAnnounce_Patch { public static void Postfix() { TryRegisterRPC(); } } private static readonly LogManager log = new LogManager("UIPlayer Logout", LogManager.LogLevel.Warning); private static HashSet<string> _previousPeers = new HashSet<string>(); private const string LogoutRPC = "MarsarahTweaks_LogoutAnnounce"; private static bool _registered = false; public static void TryRegisterRPC() { if (!_registered && ZRoutedRpc.instance != null) { ZRoutedRpc.instance.Register<string>("MarsarahTweaks_LogoutAnnounce", (Action<long, string>)OnPlayerLogoutRPC); _registered = true; log.Info("Registered LogoutAnnounce RPC", header: true); } } private static void OnPlayerLogoutRPC(long sender, string playerName) { if (ConfigManager.AnnouncePlayerLogout.Value) { MessageHud instance = MessageHud.instance; if (instance != null) { instance.ShowMessage((MessageType)1, playerName + " logged out.", 0, (Sprite)null, false); } Chat instance2 = Chat.instance; if (instance2 != null) { ((Terminal)instance2).AddString("[Server]", playerName + " logged out.", (Type)2, false); } } } } internal class UIOnlinePlayers : UIController { [HarmonyPatch(typeof(ZNet), "Update")] private class OnlinePartyIndicator_Patch { private static void Prefix(ref List<PlayerInfo> ___m_players) { if ((!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated()) && ConfigManager.ShowOnlinePlayers.Value && UIController.showUI) { playerInfoList = ___m_players; } } } [HarmonyPatch(typeof(Hud), "Awake")] private class DisableMinimapUnderNoMapPatch { private static void Postfix() { if ((!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated()) && Game.m_noMap && ConfigManager.OnlinePlayersUnderMinimap.Value) { log.Warn("Disabling OnlinePlayersUnderMinimap: no map is enabled."); ConfigManager.OnlinePlayersUnderMinimap.Value = false; } } } [HarmonyPatch(typeof(Hud), "Update")] private class OnlinePlayers_HUDUpdatePatch { private static bool lastOnlinePlayersUnderMinimap = ConfigManager.OnlinePlayersUnderMinimap.Value; private static readonly float UIPartyPlayerTextDistanceV = -25f; private static readonly bool minimalStatusEffectsLoaded = AppDomain.CurrentDomain.GetAssemblies().Any((Assembly a) => a.GetName().Name == "MinimalStatusEffects"); private static void Postfix(Hud __instance) { //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) if (((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsDedicated()) || (Object)(object)__instance == (Object)null) { return; } if (Game.m_noMap && ConfigManager.OnlinePlayersUnderMinimap.Value) { log.Warn("Cannot enable 'Online Players Under Minimap' on a no map world."); ConfigManager.OnlinePlayersUnderMinimap.Value = false; } if (minimalStatusEffectsLoaded && ConfigManager.OnlinePlayersUnderMinimap.Value) { log.Warn("Cannot enable 'Online Players Under Minimap' with 'Minimal Status Effects' enabled."); ConfigManager.OnlinePlayersUnderMinimap.Value = false; } if (ConfigManager.ShowOnlinePlayers.Value) { CreateUI(__instance); if (ConfigManager.OnlinePlayersUnderMinimap.Value != lastOnlinePlayersUnderMinimap) { lastOnlinePlayersUnderMinimap = ConfigManager.OnlinePlayersUnderMinimap.Value; UpdatePartyUIPosition(__instance); } if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && (Object)(object)UIPartyArea != (Object)null) { bool flag = IsUIHidden(); bool flag2 = IsLoadScreenActive(__instance); if (flag && UIPartyArea.activeSelf) { UIPartyArea.SetActive(false); } else if (!flag) { if (flag2 && UIPartyArea.activeSelf) { UIPartyArea.SetActive(false); } else if (!flag2) { if (ConfigManager.OnlinePlayersUnderMinimap.Value) { bool activeInHierarchy = Minimap.instance.m_mapSmall.activeInHierarchy; if (activeInHierarchy && !UIPartyArea.activeSelf) { UIPartyArea.SetActive(true); } else if (!activeInHierarchy && UIPartyArea.activeSelf) { UIPartyArea.SetActive(false); } } else if (!UIPartyArea.activeSelf) { UIPartyArea.SetActive(true); } } } } int count = playerInfoList.Count; int num = ((playerInfoList.Count <= numOnlinePlayerSlots - 1) ? playerInfoList.Count : (numOnlinePlayerSlots - 1)); if (playerInfoList.Count != 1) { if (!ConfigManager.OnlinePlayersUnderMinimap.Value) { bool enabled = UIController.showUI && !Chat.instance.IsChatDialogWindowVisible(); bool enabled2 = UIController.showUI && UIController.showPlayerList && !Chat.instance.IsChatDialogWindowVisible(); ((Behaviour)UIPlayerTexts[0]).enabled = enabled; if (UIController.showUI) { ((Graphic)UIPlayerTexts[0]).color = Color.green; UIPlayerTexts[0].text = $"Online: {count}"; } for (int i = 1; i < numOnlinePlayerSlots; i++) { if (i <= num) { ((Behaviour)UIPlayerTexts[i]).enabled = enabled2; if (UIController.showUI) { ((Graphic)UIPlayerTexts[i]).color = Color.white; UIPlayerTexts[i].text = playerInfoList[i - 1].m_name; } } else { ((Graphic)UIPlayerTexts[i]).color = Color.white; UIPlayerTexts[i].text = ""; } } return; } bool enabled3 = UIController.showUI && Minimap.instance.m_mapSmall.activeInHierarchy; bool enabled4 = UIController.showUI && UIController.showPlayerList && Minimap.instance.m_mapSmall.activeInHierarchy; ((Behaviour)UIPlayerTexts[0]).enabled = enabled3; if (UIController.showUI) { ((Graphic)UIPlayerTexts[0]).color = Color.green; UIPlayerTexts[0].text = $"Online: {count}"; } for (int j = 1; j < numOnlinePlayerSlots; j++) { if (j <= num) { ((Behaviour)UIPlayerTexts[j]).enabled = enabled4; if (UIController.showUI) { ((Graphic)UIPlayerTexts[j]).color = Color.white; UIPlayerTexts[j].text = playerInfoList[j - 1].m_name; } } else { ((Graphic)UIPlayerTexts[j]).color = Color.white; UIPlayerTexts[j].text = ""; } } } else { for (int k = 0; k < numOnlinePlayerSlots; k++) { ((Graphic)UIPlayerTexts[k]).color = Color.white; UIPlayerTexts[k].text = ""; } } return; } foreach (Text uIPlayerText in UIPlayerTexts) { if ((Object)(object)uIPlayerText != (Object)null) { ((Behaviour)uIPlayerText).enabled = false; } } } private static void CreateUI(Hud hud) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) if (UIPlayerTexts.Count <= 0 || !UIPlayerTexts.All((Text t) => (Object)(object)t != (Object)null)) { int fontSize = 16; string fontName = "AveriaSansLibre-Bold"; Vector2 sizeDelta = default(Vector2); ((Vector2)(ref sizeDelta))..ctor(120f, 30f); UIPartyArea = new GameObject("PartyArea"); UIPartyArea.SetActive(false); UIPartyArea.layer = 5; if (!ConfigManager.OnlinePlayersUnderMinimap.Value) { UIPartyArea.transform.SetParent(hud.m_rootObject.transform.parent); } else { UIPartyArea.transform.SetParent(hud.m_rootObject.transform); } RectTransform val = UIPartyArea.AddComponent<RectTransform>(); if (!ConfigManager.OnlinePlayersUnderMinimap.Value) { val.anchorMin = new Vector2(1f, 0f); val.anchorMax = new Vector2(1f, 0f); val.pivot = new Vector2(1f, 0f); val.anchoredPosition = new Vector2(-20f, 70f); } else { val.anchorMin = new Vector2(1f, 1f); val.anchorMax = new Vector2(1f, 1f); val.pivot = new Vector2(0.5f, 0.5f); val.anchoredPosition = new Vector2(-170f, -255f); } val.sizeDelta = sizeDelta; UIPartyArea.transform.localScale = Vector3.one; List<GameObject> list = new List<GameObject>(); UIPlayerTexts.Clear(); list.Clear(); for (int i = 0; i < numOnlinePlayerSlots; i++) { TextAnchor alignment = (TextAnchor)(ConfigManager.OnlinePlayersUnderMinimap.Value ? 3 : 5); Vector2 position = (ConfigManager.OnlinePlayersUnderMinimap.Value ? new Vector2(0f, UIPartyPlayerTextDistanceV * (float)i) : new Vector2(0f, (0f - UIPartyPlayerTextDistanceV) * (float)i)); Text val2 = UIController.CreateTextObject($"PartyText_{i}", UIPartyArea, Color.white, fontName, fontSize, alignment, position, sizeDelta); UIPlayerTexts.Add(val2); list.Add(((Component)val2).gameObject); } } } private static void UpdatePartyUIPosition(Hud hud) { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) log.Info("UpdatePartyUICalled"); if ((Object)(object)UIPartyArea == (Object)null) { return; } log.Info("Executing UpdatePartyUIPosition"); if (!ConfigManager.OnlinePlayersUnderMinimap.Value) { UIPartyArea.transform.SetParent(hud.m_rootObject.transform.parent, false); } else { UIPartyArea.transform.SetParent(hud.m_rootObject.transform, false); } RectTransform component = UIPartyArea.GetComponent<RectTransform>(); if (!ConfigManager.OnlinePlayersUnderMinimap.Value) { component.anchorMin = new Vector2(1f, 0f); component.anchorMax = new Vector2(1f, 0f); component.pivot = new Vector2(1f, 0f); component.anchoredPosition = new Vector2(-20f, 70f); } else { component.anchorMin = new Vector2(1f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = new Vector2(-170f, -255f); } for (int i = 0; i < UIPlayerTexts.Count; i++) { Text val = UIPlayerTexts[i]; if ((Object)(object)val != (Object)null) { RectTransform component2 = ((Component)val).GetComponent<RectTransform>(); val.alignment = (TextAnchor)(ConfigManager.OnlinePlayersUnderMinimap.Value ? 3 : 5); component2.anchoredPosition = (ConfigManager.OnlinePlayersUnderMinimap.Value ? new Vector2(0f, UIPartyPlayerTextDistanceV * (float)i) : new Vector2(0f, (0f - UIPartyPlayerTextDistanceV) * (float)i)); } } } private static bool IsLoadScreenActive(Hud hud) { if (Object.op_Implicit((Object)(object)Hud.instance) && Object.op_Implicit((Object)(object)hud.m_loadingScreen)) { return ((Component)hud.m_loadingScreen).gameObject.activeSelf; } return false; } private static bool IsUIHidden() { return Hud.IsUserHidden(); } } private static readonly LogManager log = new LogManager("UI Online Players", LogManager.LogLevel.Warning); private static List<PlayerInfo> playerInfoList = new List<PlayerInfo>(); private static int numOnlinePlayerSlots = 21; private static GameObject UIPartyArea; private static List<Text> UIPlayerTexts = new List<Text>(); } internal class UIShowOwnedResources { [HarmonyPatch(typeof(InventoryGui), "SetupRequirement")] private class ShowOwnedResources_Patch { private static void Postfix(Transform elementRoot, Requirement req, Player player, bool craft, int quality, int craftMultiplier) { //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) if (!ConfigManager.ShowOwnedResources.Value || (Object)(object)req?.m_resItem == (Object)null || (Object)(object)player == (Object)null) { return; } int num = req.GetAmount(quality) * craftMultiplier; int num2 = ((Humanoid)player).GetInventory().CountItems(req.m_resItem.m_itemData.m_shared.m_name, -1, true); Transform val = elementRoot.Find("res_amount"); if ((Object)(object)val == (Object)null) { return; } TMP_Text component = ((Component)val).GetComponent<TMP_Text>(); if (!((Object)(object)component == (Object)null)) { component.text = $"{num}/{num2}"; bool flag = (!craft && ZoneSystem.instance.GetGlobalKey((GlobalKeys)19)) || (craft && ZoneSystem.instance.GetGlobalKey((GlobalKeys)20)); if (num2 < num && !flag) { ((Graphic)component).color = ((Mathf.Sin(Time.time * 10f) > 0f) ? Color.red : Color.white); } else { ((Graphic)component).color = Color.white; } } } } private static readonly LogManager log = new LogManager("UI Show Owned Resources", LogManager.LogLevel.Warning); } internal class UISmartBiome : UIController { private struct BiomeWeights { public int _min; public int _max; public BiomeWeights(int min, int max) { _min = min; _max = max; } } [HarmonyPatch(typeof(Player), "Update")] private class SmartBiome_PlayerPatch { private static void Prefix(ref Player ___m_localPlayer) { if (((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsDedicated()) || (Object)(object)___m_localPlayer == (Object)null || !ConfigManager.ShowSmartBiome.Value || !UIController.showUI) { return; } playerArmor = ((Character)___m_localPlayer).GetBodyArmor(); List<ItemData> equippedItems = ((Humanoid)___m_localPlayer).GetInventory().GetEquippedItems(); foreach (ItemData item in equippedItems) { if (armorWeightsDict.ContainsKey(item.m_shared.m_name)) { if (!equippedArmorWeightsDict.ContainsKey(item.m_shared.m_name)) { equippedArmorWeightsDict.Add(item.m_shared.m_name, armorWeightsDict[item.m_shared.m_name] + item.m_quality - 1); } else { equippedArmorWeightsDict[item.m_shared.m_name] = armorWeightsDict[item.m_shared.m_name] + item.m_quality - 1; } } } List<string> list = new List<string>(); foreach (KeyValuePair<string, int> item2 in equippedArmorWeightsDict) { bool flag = false; foreach (ItemData item3 in equippedItems) { if (item3.m_shared.m_name == item2.Key) { flag = true; break; } } if (!flag) { list.Add(item2.Key); } } foreach (string item4 in list) { equippedArmorWeightsDict.Remove(item4); } } } [HarmonyPatch(typeof(Minimap), "UpdateBiome")] private class MoveBiomeMinimapText_Patch { private static void Prefix(ref Text ___m_biomeNameSmall, ref Player player) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsDedicated()) { if (ConfigManager.ShowSmartBiome.Value && UIController.showUI) { ((Behaviour)___m_biomeNameSmall).enabled = false; Biome currentBiome = player.GetCurrentBiome(); UISmartBiome.currentBiome = ((object)(Biome)(ref currentBiome)).ToString(); } else { ((Behaviour)___m_biomeNameSmall).enabled = true; } } } } [HarmonyPatch(typeof(Hud), "Update")] private class SmartBiome_HUDUpdatePatch { private static void Postfix(Hud __instance) { //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) if (((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsDedicated()) || (Object)(object)__instance == (Object)null) { return; } if (ConfigManager.ShowSmartBiome.Value) { CreateUI(__instance); ((Behaviour)UIBiomeText).enabled = UIController.showUI && Minimap.instance.m_mapSmall.activeInHierarchy; if (!UIController.showUI || !Minimap.instance.m_mapSmall.activeInHierarchy) { return; } if (currentBiome != null && biomeWeightsDict.ContainsKey(currentBiome)) { playerArmorWeight = 0; foreach (KeyValuePair<string, int> item in equippedArmorWeightsDict) { playerArmorWeight += item.Value; } float num = biomeWeightsDict[currentBiome]._min; float num2 = (float)biomeWeightsDict[currentBiome]._max - num; float percent = ((float)playerArmorWeight - num) * 100f / num2; ((Graphic)UIBiomeText).color = GetColorFromPercent(percent); } else { ((Graphic)UIBiomeText).color = Color.white; } UIBiomeText.text = ((currentBiome == "BlackForest") ? "Black forest" : ((currentBiome == "AshLands") ? "Ashlands" : currentBiome)); } else if ((Object)(object)UIBiomeText != (Object)null) { ((Behaviour)UIBiomeText).enabled = false; } } private static void CreateUI(Hud hud) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)UIBiomeText != (Object)null)) { int fontSize = 16; string fontName = "AveriaSansLibre-Bold"; Vector2 sizeDelta = default(Vector2); ((Vector2)(ref sizeDelta))..ctor(150f, 30f); GameObject val = new GameObject("BiomeArea"); val.layer = 5; val.transform.SetParent(hud.m_rootObject.transform); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(1f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.anchoredPosition = new Vector2(-125f, -55f); obj.sizeDelta = sizeDelta; val.transform.localScal