Decompiled source of PeakStatsEx v1.2.18
plugins/com.github.LengSword.PeakStatsEx.dll
Decompiled a day 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.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DG.Tweening; using DG.Tweening.Core; using DG.Tweening.Plugins.Options; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using PeakStatsEx.Compatibility; using PeakStatsEx.MonoBehaviours; using Photon.Pun; using Steamworks; using TMPro; using TerrainCustomiser; using TerrainRandomiser; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; using Zorro.Core; using Zorro.Core.Editor; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.LengSword.PeakStatsEx")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.2.18.0")] [assembly: AssemblyInformationalVersion("1.2.18+9ac89db5111cc5d1322d03bd05612a07ab7be38e")] [assembly: AssemblyProduct("com.github.LengSword.PeakStatsEx")] [assembly: AssemblyTitle("PeakStatsEx")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.18.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace PeakStatsEx { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.github.LengSword.PeakStatsEx", "PeakStatsEx", "1.2.18")] public class Plugin : BaseUnityPlugin { public const string Id = "com.github.LengSword.PeakStatsEx"; internal static ManualLogSource Logger { get; private set; } public static string Name => "PeakStatsEx"; public static string Version => "1.2.18"; private void Awake() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)("Plugin " + Name + " is loaded!")); PluginConfig.Initialize(((BaseUnityPlugin)this).Config, Logger); Harmony val = new Harmony("com.github.LengSword.PeakStatsEx"); val.PatchAll(); } } [HarmonyWrapSafe] internal sealed class Patches { [HarmonyPatch(typeof(GUIManager), "Start")] [HarmonyPostfix] private static void GUIManagerStartHook(GUIManager __instance) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "Airport") { CreateTimerAndHeightStats(); CreateMapStats(); } FixBarGroup(); void CreateMapStats() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)((Component)__instance).GetComponentInChildren<AscentUI>()).transform; RectTransform val = (RectTransform)Object.Instantiate<Transform>(transform, transform.parent); ((Object)val).name = "Map & Level UI"; Object.Destroy((Object)(object)((Component)val).GetComponent<AscentUI>()); ((Component)val).gameObject.AddComponent<MapStats>(); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(1f, 1f); val.anchorMin = val2; Vector2 pivot = (val.anchorMax = val2); val.pivot = pivot; val.anchoredPosition = new Vector2(0f, 5f); } void CreateTimerAndHeightStats() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)((Component)__instance).GetComponentInChildren<AscentUI>()).transform; RectTransform val = (RectTransform)Object.Instantiate<Transform>(transform, transform.parent); ((Object)val).name = "Timer & Height UI"; Object.Destroy((Object)(object)((Component)val).GetComponent<AscentUI>()); ((Component)val).gameObject.AddComponent<TimerHeightStats>(); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 1f); val.anchorMin = val2; Vector2 pivot = (val.anchorMax = val2); val.pivot = pivot; val.anchoredPosition = Vector2.zero; } void FixBarGroup() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (RectTransform)((Component)__instance.bar).transform.parent; val.sizeDelta = new Vector2(600f, 1200f); Vector2 anchoredPosition = val.anchoredPosition; anchoredPosition.y = 660f; val.anchoredPosition = anchoredPosition; ((HorizontalOrVerticalLayoutGroup)((Component)val).GetComponent<VerticalLayoutGroup>()).spacing = CharacterStaminaBar.GetGroupSpacing(); } } [HarmonyPatch(typeof(PlayerHandler), "RegisterCharacter")] [HarmonyPostfix] private static void PlayerHandlerRegisterCharacterHook(Character character) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)character != (Object)null && (Object)(object)((MonoBehaviourPun)character).photonView != (Object)null && ((MonoBehaviourPun)character).photonView.IsMine) { Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "Airport" && (Object)(object)((Component)character).GetComponent<ProximityStaminaManager>() == (Object)null) { ((Component)character).gameObject.AddComponent<ProximityStaminaManager>(); } } } [HarmonyPatch(typeof(LoadingScreenHandler), "LoadSceneProcess")] [HarmonyPostfix] private static void LoadSceneProcessHook(string sceneName) { if (sceneName.Contains("Level_")) { MapStats.currentLevelName = sceneName; MapStats.currentLevelIndex = -1; Plugin.Logger.LogDebug((object)("After: LoadingScreenHandler.LoadSceneProcess called. sceneName: " + sceneName)); } } } internal static class StringExtensions { public static string TrimToByteLength(this string input, int byteLength) { if (string.IsNullOrEmpty(input)) { return input; } int byteCount = Encoding.UTF8.GetByteCount(input); if (byteCount <= byteLength) { return input; } if (byteCount == input.Length) { return input.Substring(0, byteLength); } byte[] array = Encoding.UTF8.GetBytes(input); Array.Resize(ref array, byteLength); string text = Encoding.UTF8.GetString(array, 0, byteLength); return text.TrimEnd('\ufffd'); } } public static class PluginConfig { internal static ConfigEntry<bool> DisplayTimer { get; private set; } internal static ConfigEntry<bool> DisplayHeight { get; private set; } internal static ConfigEntry<bool> DisplayLevel { get; private set; } internal static ConfigEntry<bool> DisplayBiomes { get; private set; } internal static ConfigEntry<bool> DisplaySelfStaminaBar { get; private set; } internal static ConfigEntry<bool> DisplayDayNightCountdown { get; private set; } internal static ConfigEntry<bool> DisplayFog { get; private set; } internal static ConfigEntry<bool> DisplayLava { get; private set; } internal static ConfigEntry<bool> DisplayTerrainRandomiserSeed { get; private set; } internal static ConfigEntry<bool> DisplayTerrainCustomiserSeed { get; private set; } internal static ConfigEntry<int> SelfStaminaBarCount { get; private set; } internal static ConfigEntry<bool> DisplayTeammateStaminaBars { get; private set; } internal static ConfigEntry<float> TeammateStaminaBarProximity { get; private set; } internal static ConfigEntry<int> TeammateStaminaBarLimit { get; private set; } internal static ConfigEntry<float> TeammateStaminaBarScale { get; private set; } internal static ConfigEntry<bool> ShowInventorySlots { get; private set; } internal static ConfigEntry<bool> ShowStaminaInfo { get; private set; } internal static ConfigEntry<float> StaminaInfoFontSize { get; private set; } internal static ConfigEntry<float> StaminaInfoOutlineWidth { get; private set; } internal static ConfigEntry<bool> StaminaInfoRoundStaminaBars { get; private set; } internal static ConfigEntry<bool> StaminaInfoRoundAfflictionBars { get; private set; } internal static ConfigEntry<bool> StaminaInfoShowAfflictionCountdown { get; private set; } internal static ConfigEntry<bool> StaminaInfoShowHungerCountdown { get; private set; } internal static ConfigEntry<bool> StaminaInfoShowTeammateExtraStaminaOutsideBar { get; private set; } public static void Initialize(ConfigFile config, ManualLogSource logger) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Expected O, but got Unknown DisplayTeammateStaminaBars = config.Bind<bool>("General", "Display Teammate Stamina Bars", true, "Displays your teammates' stamina bars at the bottom left of your screen"); TeammateStaminaBarProximity = config.Bind<float>("General", "Teammate Stamina Bar Proximity", 30f, new ConfigDescription("How close you need to be to your teammate to see their stamina bar", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10000f), Array.Empty<object>())); TeammateStaminaBarLimit = config.Bind<int>("General", "Teammate Stamina Bar Limit", 4, new ConfigDescription("Max teammate stamina bars", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 16), Array.Empty<object>())); TeammateStaminaBarScale = config.Bind<float>("General", "Teammate Stamina Bar Scale (Default: 0.72)", 0.72f, new ConfigDescription("Teammate stamina bars scale", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 1f), Array.Empty<object>())); ShowInventorySlots = config.Bind<bool>("General", "Show Inventory Slots", true, "Show teammate inventory slots"); ShowStaminaInfo = config.Bind<bool>("General", "Show Stamina Info", true, "Show all stamina bars info number (current stamina, extra stamina, affliction bars) when stamina bar is visible"); DisplayTimer = config.Bind<bool>("Stats", "Display Timer", true, "Displays how long you've been climbing for, at the top of your screen"); DisplayHeight = config.Bind<bool>("Stats", "Display Height", true, "Displays how far you've climbed, in meters, at the top of your screen"); DisplayLevel = config.Bind<bool>("Stats", "Display Level", true, "Displays current map level name, at the top right of your screen"); DisplayBiomes = config.Bind<bool>("Stats", "Display Biomes", true, "Displays current map biomes name, at the top right of your screen"); DisplayDayNightCountdown = config.Bind<bool>("Stats", "Display Day Night Countdown", true, "Displays current day and night countdown, at the top of your screen"); DisplayFog = config.Bind<bool>("Stats", "Display Fog Stats", true, "Displays current fog stats, at the top of your screen"); DisplayLava = config.Bind<bool>("Stats", "Display Lava Stats", true, "Displays current kiln lava, gloom, and void ghost rising stats, at the top of your screen"); DisplayTerrainRandomiserSeed = config.Bind<bool>("Stats", "Display Terrain Randomiser Seed", true, "Displays current terrain randomiser seed, at the top right of your screen"); DisplayTerrainCustomiserSeed = config.Bind<bool>("Stats", "Display Terrain Customiser Seed", true, "Displays current terrain customiser seed, at the top right of your screen"); StaminaInfoFontSize = config.Bind<float>("StaminaInfo", "Bar Font Size", 20f, "Customize the Font Size for stamina bar text."); StaminaInfoOutlineWidth = config.Bind<float>("StaminaInfo", "Bar Outline Width", 0.08f, "Customize the Outline Width for stamina bar text."); StaminaInfoRoundStaminaBars = config.Bind<bool>("StaminaInfo", "Round Stamina Bars", true, "If true, rounds to the nearest whole number for the stamina and extra stamina bars."); StaminaInfoRoundAfflictionBars = config.Bind<bool>("StaminaInfo", "Round Affliction Bars", false, "If true, rounds to the nearest whole number for affliction bars."); StaminaInfoShowAfflictionCountdown = config.Bind<bool>("StaminaInfo", "Show Affliction Countdown", true, "If true, show self affliction bars with countdown."); StaminaInfoShowHungerCountdown = config.Bind<bool>("StaminaInfo", "Show Hunger Countdown", true, "If true, show local hunger countdown values in stamina info."); StaminaInfoShowTeammateExtraStaminaOutsideBar = config.Bind<bool>("StaminaInfo", "Show Teammate Extra Stamina Outside Bar", false, "If true, show teammate extra stamina values outside the right side of the full extra stamina bar with a + prefix. If false, show them inside the extra stamina bar."); DisplaySelfStaminaBar = config.Bind<bool>("Debug", "Display Self Stamina Bar", false, "Displays your stamina bar at the bottom left of your screen"); SelfStaminaBarCount = config.Bind<int>("Debug", "Self Stamina Bar Count", 1, new ConfigDescription("Number of duplicate self stamina bars to display when Display Self Stamina Bar is enabled", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 16), Array.Empty<object>())); logger.LogInfo((object)"Plugin Config Loaded."); } } [HarmonyWrapSafe] internal sealed class StaminaInfoPatch { internal static GUIManager guiManager = null; internal static Dictionary<string, TextMeshProUGUI> barTexts = new Dictionary<string, TextMeshProUGUI>(); internal static Dictionary<string, float> lastKnownData = new Dictionary<string, float>(); internal static Dictionary<string, float> lastKnownAffData = new Dictionary<string, float>(); internal static Dictionary<string, float> lastAfflictionUpdateTime = new Dictionary<string, float>(); private const float LargeBarThreshold = 30f; private const float SmallBarThreshold = 15f; private const float BarUnitSize = 6f; private const float AfflictionRefreshInterval = 0.5f; private const float HungerIncrementThreshold = 0.025f; private const float CharacterExtraStaminaTextOffsetX = 6f; private const float CharacterExtraStaminaTextWidth = 80f; private const string HiddenHungerCountdownKey = "HiddenHungerCountdown"; private const string YellowTextStart = "<color=#FFFF00>"; private const string ColorTextEnd = "</color>"; private static readonly Dictionary<int, float> hungerIncrementalStatuses = new Dictionary<int, float>(); private static readonly Dictionary<int, float> lastTrackedHungerAddTimes = new Dictionary<int, float>(); private static readonly Dictionary<int, float> lastObservedRealHungerIncrementalStatuses = new Dictionary<int, float>(); private static readonly Dictionary<int, float> lastRealHungerProgressTimes = new Dictionary<int, float>(); private static readonly Dictionary<int, bool> wasHungerBlockedByVanilla = new Dictionary<int, bool>(); private static readonly FieldInfo? currentIncrementalStatusesField = AccessTools.Field(typeof(CharacterAfflictions), "currentIncrementalStatuses"); private static bool wasHiddenHungerCountdownShown; internal static Dictionary<int, float> LastUpdateTime { get; set; } = new Dictionary<int, float>(); [HarmonyPatch(typeof(StaminaBar), "Update")] [HarmonyPostfix] private static void StaminaInfoStaminaBarUpdate(StaminaBar __instance) { try { if ((Object)(object)guiManager == (Object)null) { barTexts = new Dictionary<string, TextMeshProUGUI>(); lastKnownData = new Dictionary<string, float>(); lastKnownAffData = new Dictionary<string, float>(); lastAfflictionUpdateTime = new Dictionary<string, float>(); InitStaminaInfo(__instance); } if (!PluginConfig.ShowStaminaInfo.Value) { HideBarTexts(__instance); } else if ((Object)(object)Character.observedCharacter != (Object)null) { UpdateBarTexts(__instance); } } catch (Exception ex) { Plugin.Logger.LogError((object)(ex.Message + ex.StackTrace)); } } [HarmonyPatch(typeof(CharacterStaminaBar), "Update")] [HarmonyPostfix] public static void Update(CharacterStaminaBar __instance) { try { int instanceID = ((Object)__instance).GetInstanceID(); if (!LastUpdateTime.ContainsKey(instanceID)) { LastUpdateTime.Add(instanceID, -1f); } if (!barTexts.ContainsKey(GetCharacterStaminaKey(instanceID))) { InitCharacterStaminaInfo(__instance); } if (!PluginConfig.ShowStaminaInfo.Value) { HideCharacterBarTexts(__instance); } else if ((Object)(object)Character.observedCharacter != (Object)null && Time.time - LastUpdateTime[instanceID] > 1f) { UpdateCharacterBarTexts(__instance); LastUpdateTime[instanceID] = Time.time; } } catch (Exception ex) { Plugin.Logger.LogError((object)(ex.Message + ex.StackTrace)); } } [HarmonyPatch(typeof(CharacterAfflictions), "AddStatus")] [HarmonyPostfix] private static void CharacterAfflictionsAddStatusPostfix(CharacterAfflictions __instance, STATUSTYPE statusType, float amount, bool __result) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)statusType != 1 || amount <= 0f) { return; } if (__result) { if (TryReadCurrentIncrementalHunger(__instance, out var currentIncrementalStatus)) { SetFallbackHungerIncrementalStatus(__instance, currentIncrementalStatus); } else { AddFallbackHungerIncrementalStatus(__instance, amount); } } else if (ShouldTrackHungerAdd(__instance)) { AddFallbackHungerIncrementalStatus(__instance, amount); } } private static bool ShouldTrackHungerAdd(CharacterAfflictions afflictions) { Character observedCharacter = Character.observedCharacter; if ((Object)(object)observedCharacter?.refs?.afflictions != (Object)(object)afflictions) { return false; } if (observedCharacter.data.fullyConscious && afflictions.canGetHungry) { return afflictions.hungerPerSecond * Ascents.hungerRateMultiplier > 0f; } return false; } private static void AddFallbackHungerIncrementalStatus(CharacterAfflictions afflictions, float amount) { int instanceID = ((Object)afflictions).GetInstanceID(); hungerIncrementalStatuses.TryGetValue(instanceID, out var value); value += amount; SetFallbackHungerIncrementalStatus(afflictions, (value >= 0.025f) ? 0f : value); } private static void SetFallbackHungerIncrementalStatus(CharacterAfflictions afflictions, float currentIncrementalStatus) { int instanceID = ((Object)afflictions).GetInstanceID(); hungerIncrementalStatuses[instanceID] = currentIncrementalStatus; lastTrackedHungerAddTimes[instanceID] = Time.time; } private static void ClearFallbackHungerIncrementalStatus(CharacterAfflictions afflictions) { hungerIncrementalStatuses[((Object)afflictions).GetInstanceID()] = 0f; } private static float GetFallbackHungerIncrementalStatus(CharacterAfflictions afflictions) { int instanceID = ((Object)afflictions).GetInstanceID(); hungerIncrementalStatuses.TryGetValue(instanceID, out var value); return value; } [HarmonyPatch(typeof(CharacterAfflictions), "SubtractStatus")] [HarmonyPrefix] private static void CharacterAfflictionsSubtractStatusPrefix(CharacterAfflictions __instance, STATUSTYPE statusType, ref float __state) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 __state = (((int)statusType == 1) ? __instance.GetCurrentStatus((STATUSTYPE)1) : (-1f)); } [HarmonyPatch(typeof(CharacterAfflictions), "SubtractStatus")] [HarmonyPostfix] private static void CharacterAfflictionsSubtractStatusPostfix(CharacterAfflictions __instance, STATUSTYPE statusType, float __state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)statusType == 1 && !(__state <= 0f)) { float currentStatus = __instance.GetCurrentStatus((STATUSTYPE)1); if (currentStatus < __state) { hungerIncrementalStatuses[((Object)__instance).GetInstanceID()] = 0f; } } } [HarmonyPatch(typeof(CharacterAfflictions), "SetStatus")] [HarmonyPostfix] private static void CharacterAfflictionsSetStatusPostfix(CharacterAfflictions __instance, STATUSTYPE statusType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)statusType == 1) { hungerIncrementalStatuses[((Object)__instance).GetInstanceID()] = 0f; } } private static void UpdateBarTexts(StaminaBar staminaBar) { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) bool forceUpdate; string staminaHungerCountdownSuffix = GetStaminaHungerCountdownSuffix(staminaBar, out forceUpdate); bool flag = staminaBar.desiredStaminaSize >= 15f; UpdateMaxStaminaHungerCountdown(staminaBar, flag ? string.Empty : staminaHungerCountdownSuffix, forceUpdate); UpdateBarText(((Object)staminaBar.staminaBar).name, staminaBar.desiredStaminaSize, PluginConfig.StaminaInfoRoundStaminaBars.Value, trimWholeDecimal: false, lastKnownData, "", flag ? staminaHungerCountdownSuffix : string.Empty, forceUpdate); if (forceUpdate) { lastAfflictionUpdateTime["HiddenHungerCountdown"] = Time.time; } UpdateBarText("ExtraStamina", staminaBar.desiredExtraStaminaSize, PluginConfig.StaminaInfoRoundStaminaBars.Value, trimWholeDecimal: false, lastKnownData); BarAffliction[] afflictions = staminaBar.afflictions; foreach (BarAffliction val in afflictions) { string name = ((Object)val).name; bool flag2 = CanShowCountdown(val.afflictionType); bool flag3 = flag2 && val.size > 0f && (!lastAfflictionUpdateTime.ContainsKey(name) || Time.time - lastAfflictionUpdateTime[name] > 0.5f); string suffix = string.Empty; if (flag2 && IsCountdownEnabled(val.afflictionType)) { float reductionTimeRemaining = GetReductionTimeRemaining(val.afflictionType); if (reductionTimeRemaining > 0f && !ShouldMoveHungerCountdownToStamina(val, reductionTimeRemaining)) { suffix = "(" + FormatTime(reductionTimeRemaining) + ")"; } } UpdateBarText(name, val.size, PluginConfig.StaminaInfoRoundAfflictionBars.Value, trimWholeDecimal: true, lastKnownAffData, "", suffix, flag3); if (flag3) { lastAfflictionUpdateTime[name] = Time.time; } } } private static void UpdateMaxStaminaHungerCountdown(StaminaBar staminaBar, string suffix, bool forceUpdate) { //IL_0053: 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) if (!barTexts.TryGetValue("HiddenHungerCountdown", out TextMeshProUGUI value)) { return; } if (string.IsNullOrEmpty(suffix)) { ((Component)value).gameObject.SetActive(false); return; } Transform val = ((Component)staminaBar).transform.Find("LayoutGroup/MaxStamina"); RectTransform val2 = (RectTransform)(object)((val is RectTransform) ? val : null); if (val2 == null) { ((Component)value).gameObject.SetActive(false); return; } float x = ((TMP_Text)value).GetPreferredValues(suffix).x; if (x > val2.sizeDelta.x) { ((Component)value).gameObject.SetActive(false); } else if (forceUpdate || !((Component)value).gameObject.activeSelf) { ((TMP_Text)value).text = suffix; ((Component)value).gameObject.SetActive(true); } } private static string GetStaminaHungerCountdownSuffix(StaminaBar staminaBar, out bool forceUpdate) { forceUpdate = false; Character observedCharacter = Character.observedCharacter; CharacterAfflictions val = observedCharacter?.refs?.afflictions; float num = 0f; bool flag = PluginConfig.StaminaInfoShowHungerCountdown.Value && (Object)(object)observedCharacter != (Object)null && (Object)(object)val != (Object)null; bool flag2 = false; if (flag) { num = GetHungerIncreaseTimeRemaining(observedCharacter, val); BarAffliction hungerBar = GetHungerBar(staminaBar); flag2 = num > 0f && ((Object)(object)hungerBar == (Object)null || !IsVisibleAfflictionBar(hungerBar) || ShouldMoveHungerCountdownToStamina(hungerBar, num)); } string text = string.Empty; if (flag2) { text = "<color=#FFFF00>(" + FormatTime(num) + ")</color>"; } bool flag3 = !string.IsNullOrEmpty(text); forceUpdate = wasHiddenHungerCountdownShown != flag3 || (flag3 && (!lastAfflictionUpdateTime.ContainsKey("HiddenHungerCountdown") || Time.time - lastAfflictionUpdateTime["HiddenHungerCountdown"] > 0.5f)); wasHiddenHungerCountdownShown = flag3; return text; } private static BarAffliction? GetHungerBar(StaminaBar staminaBar) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 BarAffliction[] afflictions = staminaBar.afflictions; foreach (BarAffliction val in afflictions) { if ((int)val.afflictionType == 1) { return val; } } return null; } private static bool IsVisibleAfflictionBar(BarAffliction affliction) { if (((Component)affliction).gameObject.activeSelf) { return affliction.size >= 15f; } return false; } private static bool ShouldMoveHungerCountdownToStamina(BarAffliction affliction, float timeRemaining) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_005e: Unknown result type (might be due to invalid IL or missing references) if ((int)affliction.afflictionType != 1 || !IsVisibleAfflictionBar(affliction)) { return false; } if (!barTexts.TryGetValue(((Object)affliction).name, out TextMeshProUGUI value)) { return false; } string text = FormatBarValue(affliction.size, PluginConfig.StaminaInfoRoundAfflictionBars.Value, trimWholeDecimal: true); string text2 = "(" + FormatTime(timeRemaining) + ")"; float x = ((TMP_Text)value).GetPreferredValues(text + text2).x; return x > affliction.size; } public static void UpdateCharacterBarTexts(CharacterStaminaBar characterStaminaBar) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)characterStaminaBar.ObservedCharacter == (Object)null) { return; } int instanceID = ((Object)characterStaminaBar).GetInstanceID(); float size = Mathf.Max(0f, characterStaminaBar.ObservedCharacter.data.currentStamina * characterStaminaBar.fullBarRectTransform.sizeDelta.x); UpdateBarText(GetCharacterStaminaKey(instanceID), size, PluginConfig.StaminaInfoRoundStaminaBars.Value, trimWholeDecimal: false, lastKnownData); float size2 = Mathf.Max(0f, characterStaminaBar.ObservedCharacter.data.extraStamina * characterStaminaBar.fullBarRectTransform.sizeDelta.x); bool value = PluginConfig.StaminaInfoShowTeammateExtraStaminaOutsideBar.Value; ApplyCharacterExtraStaminaTextLayout(characterStaminaBar, value); UpdateBarText(GetCharacterExtraStaminaKey(instanceID), size2, PluginConfig.StaminaInfoRoundStaminaBars.Value, trimWholeDecimal: false, lastKnownData, value ? "+" : string.Empty); foreach (CharacterBarAffliction characterBarAffliction in characterStaminaBar.characterBarAfflictions) { characterBarAffliction.FetchDesiredSize(); UpdateBarText(GetCharacterAfflictionKey(instanceID, characterBarAffliction), characterBarAffliction.size, PluginConfig.StaminaInfoRoundAfflictionBars.Value, trimWholeDecimal: true, lastKnownAffData); } } private static void UpdateBarText(string key, float size, bool roundLargeValue, bool trimWholeDecimal, Dictionary<string, float> cache, string prefix = "", string suffix = "", bool forceUpdate = false) { if (!barTexts.TryGetValue(key, out TextMeshProUGUI value)) { return; } bool flag = forceUpdate || !cache.ContainsKey(key) || !Mathf.Approximately(cache[key], size) || !((Component)value).gameObject.activeSelf; if (size < 15f) { ((Component)value).gameObject.SetActive(false); cache[key] = size; return; } string text = prefix + FormatBarValue(size, roundLargeValue, trimWholeDecimal); string text2 = (string.IsNullOrEmpty(suffix) ? text : (text + suffix)); if (flag || ((TMP_Text)value).text != text2) { ((TMP_Text)value).text = text2; ((Component)value).gameObject.SetActive(true); cache[key] = size; } } private static string FormatBarValue(float size, bool roundLargeValue, bool trimWholeDecimal) { if (size >= 30f) { float num = size / 6f; if (roundLargeValue) { return Mathf.Round(num).ToString(); } string text = num.ToString("F1"); if (!trimWholeDecimal) { return text; } return text.Replace(".0", ""); } return Mathf.Round(size / 6f).ToString(); } private static void HideBarTexts(StaminaBar staminaBar) { HideText(((Object)staminaBar.staminaBar).name); HideText("ExtraStamina"); HideText("HiddenHungerCountdown"); BarAffliction[] afflictions = staminaBar.afflictions; foreach (BarAffliction val in afflictions) { HideText(((Object)val).name); } } private static void HideCharacterBarTexts(CharacterStaminaBar characterStaminaBar) { int instanceID = ((Object)characterStaminaBar).GetInstanceID(); HideText(GetCharacterStaminaKey(instanceID)); HideText(GetCharacterExtraStaminaKey(instanceID)); foreach (CharacterBarAffliction characterBarAffliction in characterStaminaBar.characterBarAfflictions) { HideText(GetCharacterAfflictionKey(instanceID, characterBarAffliction)); } } private static void HideText(string key) { if (barTexts.TryGetValue(key, out TextMeshProUGUI value)) { ((Component)value).gameObject.SetActive(false); } } private static bool CanShowCountdown(STATUSTYPE afflictionType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: 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_0009: Invalid comparison between Unknown and I4 if ((int)afflictionType != 7 && (int)afflictionType != 0) { return (int)afflictionType != 5; } return false; } private static bool IsCountdownEnabled(STATUSTYPE afflictionType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)afflictionType != 1) { return PluginConfig.StaminaInfoShowAfflictionCountdown.Value; } return PluginConfig.StaminaInfoShowHungerCountdown.Value; } private static string GetCharacterStaminaKey(int id) { return id + "_Stamina"; } private static string GetCharacterExtraStaminaKey(int id) { return id + "_ExtraStamina"; } private static string GetCharacterAfflictionKey(int id, CharacterBarAffliction affliction) { return id + "_" + ((Object)((Component)affliction).gameObject).name; } private static void InitStaminaInfo(StaminaBar staminaBar) { GameObject val = GameObject.Find("GAME/GUIManager"); guiManager = val.GetComponent<GUIManager>(); AddTextObject(((Component)staminaBar.staminaBar).gameObject, ((Object)staminaBar.staminaBar).name); AddMaxStaminaHungerCountdownTextObject(staminaBar); AddTextObject(((Component)staminaBar.extraBarStamina).gameObject, "ExtraStamina"); BarAffliction[] afflictions = staminaBar.afflictions; foreach (BarAffliction val2 in afflictions) { AddTextObject(((Component)val2).gameObject, ((Object)((Component)val2).gameObject).name); } } public static void InitCharacterStaminaInfo(CharacterStaminaBar characterStaminaBar) { int instanceID = ((Object)characterStaminaBar).GetInstanceID(); AddTextObject(((Component)characterStaminaBar.staminaBarRectTransform).gameObject, GetCharacterStaminaKey(instanceID)); string characterExtraStaminaKey = GetCharacterExtraStaminaKey(instanceID); AddTextObject(((Component)characterStaminaBar.extraBar).gameObject, characterExtraStaminaKey); ApplyCharacterExtraStaminaTextLayout(characterStaminaBar, PluginConfig.StaminaInfoShowTeammateExtraStaminaOutsideBar.Value); foreach (CharacterBarAffliction characterBarAffliction in characterStaminaBar.characterBarAfflictions) { AddTextObject(((Component)characterBarAffliction).gameObject, GetCharacterAfflictionKey(instanceID, characterBarAffliction)); } } private static void ApplyCharacterExtraStaminaTextLayout(CharacterStaminaBar characterStaminaBar, bool showOutsideBar) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) string characterExtraStaminaKey = GetCharacterExtraStaminaKey(((Object)characterStaminaBar).GetInstanceID()); if (!barTexts.TryGetValue(characterExtraStaminaKey, out TextMeshProUGUI value)) { return; } if (showOutsideBar) { if ((Object)(object)((TMP_Text)value).transform.parent != (Object)(object)characterStaminaBar.extraBar) { ((TMP_Text)value).transform.SetParent((Transform)(object)characterStaminaBar.extraBar, false); } ((Graphic)value).color = Color.green; PositionCharacterExtraStaminaTextOutsideBar(value, characterStaminaBar); } else { if ((Object)(object)((TMP_Text)value).transform.parent != (Object)(object)characterStaminaBar.extraBarStamina) { ((TMP_Text)value).transform.SetParent((Transform)(object)characterStaminaBar.extraBarStamina, false); } PositionCharacterExtraStaminaTextInsideBar(value); } } private static void PositionCharacterExtraStaminaTextInsideBar(TextMeshProUGUI text) { //IL_0008: 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_0028: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) RectTransform rectTransform = ((TMP_Text)text).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.pivot = new Vector2(0.5f, 0.5f); rectTransform.anchoredPosition = Vector2.zero; ((Transform)rectTransform).localRotation = Quaternion.identity; ((Transform)rectTransform).localScale = Vector3.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; ((Graphic)text).color = Color.black; ((TMP_Text)text).alignment = (TextAlignmentOptions)514; } private static void PositionCharacterExtraStaminaTextOutsideBar(TextMeshProUGUI text, CharacterStaminaBar characterStaminaBar) { //IL_000f: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) RectTransform rectTransform = ((TMP_Text)text).rectTransform; RectTransform extraBarOutline = characterStaminaBar.extraBarOutline; float num = extraBarOutline.anchoredPosition.x + extraBarOutline.sizeDelta.x * (1f - extraBarOutline.pivot.x); rectTransform.anchorMin = new Vector2(0f, 0.5f); rectTransform.anchorMax = new Vector2(0f, 0.5f); rectTransform.pivot = new Vector2(0f, 0.5f); rectTransform.anchoredPosition = new Vector2(num + 6f, extraBarOutline.anchoredPosition.y); rectTransform.sizeDelta = new Vector2(80f, Mathf.Max(extraBarOutline.sizeDelta.y, 1f)); ((Transform)rectTransform).localRotation = Quaternion.identity; ((Transform)rectTransform).localScale = Vector3.one; ((TMP_Text)text).alignment = (TextAlignmentOptions)513; } private static void AddMaxStaminaHungerCountdownTextObject(StaminaBar staminaBar) { Transform val = ((Component)staminaBar).transform.Find("LayoutGroup/MaxStamina"); if (!((Object)(object)val == (Object)null)) { AddTextObject(((Component)val).gameObject, "HiddenHungerCountdown"); } } internal static void AddTextObject(GameObject gameObj, string barName) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_007e: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_00e8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)guiManager == (Object)null) { guiManager = GUIManager.instance; } if ((Object)(object)guiManager == (Object)null) { return; } TMP_FontAsset font = ((TMP_Text)guiManager.heroDayText).font; GameObject val = new GameObject("StaminaInfo"); val.transform.SetParent(gameObj.transform); TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); RectTransform component = val.GetComponent<RectTransform>(); gameObj.SetActive(true); ((TMP_Text)val2).font = font; ((TMP_Text)val2).fontSize = PluginConfig.StaminaInfoFontSize.Value; component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = Vector2.zero; ((Transform)component).localRotation = Quaternion.identity; CharacterBarAffliction characterBarAffliction = default(CharacterBarAffliction); ((Transform)component).localScale = (Vector3)((gameObj.TryGetComponent<CharacterBarAffliction>(ref characterBarAffliction) && characterBarAffliction.isPetrify) ? new Vector3(1.4285715f, 2f, 1f) : Vector3.one); component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; ((TMP_Text)val2).alignment = (TextAlignmentOptions)514; ((TMP_Text)val2).verticalAlignment = (VerticalAlignmentOptions)8192; ((TMP_Text)val2).richText = true; ((TMP_Text)val2).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)val2).text = ""; ((Component)val2).gameObject.SetActive(false); barTexts[barName] = val2; lastKnownData[barName] = 0f; lastKnownAffData[barName] = 0f; lastAfflictionUpdateTime[barName] = -1f; try { ((TMP_Text)val2).outlineWidth = PluginConfig.StaminaInfoOutlineWidth.Value; } catch { } } private static float GetReductionTimeRemaining(STATUSTYPE statusType) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Invalid comparison between Unknown and I4 //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) CharacterAfflictions val = Character.observedCharacter?.refs?.afflictions; if ((Object)(object)val == (Object)null) { return 0f; } if ((int)statusType == 1) { Character observedCharacter = Character.observedCharacter; if (!((Object)(object)observedCharacter == (Object)null)) { return GetHungerIncreaseTimeRemaining(observedCharacter, val); } return 0f; } if ((int)statusType == 9) { float num = 0f; int num2 = 0; foreach (ThornOnMe physicalThorn in val.physicalThorns) { if (physicalThorn.stuckIn) { num2++; num += Time.time - physicalThorn.popOutTime; } } if (num2 == 0) { return 0f; } return Mathf.Abs(num) / (float)num2; } float currentStatus = val.GetCurrentStatus(statusType); if (currentStatus <= 0f) { return 0f; } float reductionRate = GetReductionRate(val, statusType); if (reductionRate <= 0f) { return 0f; } float cooldown = GetCooldown(val, statusType); float num3 = val.LastAddedStatus(statusType); float time = Time.time; if (cooldown > 0f && time - num3 < cooldown) { float num4 = cooldown - (time - num3); float num5 = currentStatus / reductionRate; return num4 + num5; } return currentStatus / reductionRate; } private static float GetHungerIncreaseTimeRemaining(Character character, CharacterAfflictions afflictions) { if ((Object)(object)character == (Object)null || (Object)(object)character != (Object)(object)Character.localCharacter || !character.data.fullyConscious || afflictions.m_inAirport) { return 0f; } float num = afflictions.hungerPerSecond * Ascents.hungerRateMultiplier; if (num <= 0f) { return 0f; } bool flag = character.data.isInvincible || !afflictions.canGetHungry; if (flag) { ResetRealHungerProgressWhenBlockedStateStarts(afflictions); } else { wasHungerBlockedByVanilla[((Object)afflictions).GetInstanceID()] = false; } bool flag2 = HasRecentlyObservedRealHungerProgress(afflictions); if (flag && !flag2) { ClearFallbackHungerIncrementalStatus(afflictions); } float hungerIncrementalStatus = GetHungerIncrementalStatus(afflictions); float num2 = 0.025f - hungerIncrementalStatus; if (num2 <= 0f) { num2 = 0.025f; } return num2 / num; } private static void ResetRealHungerProgressWhenBlockedStateStarts(CharacterAfflictions afflictions) { int instanceID = ((Object)afflictions).GetInstanceID(); if (!(wasHungerBlockedByVanilla.TryGetValue(instanceID, out var value) && value)) { wasHungerBlockedByVanilla[instanceID] = true; lastRealHungerProgressTimes.Remove(instanceID); if (TryReadCurrentIncrementalHunger(afflictions, out var currentIncrementalStatus)) { lastObservedRealHungerIncrementalStatuses[instanceID] = currentIncrementalStatus; } } } private static bool HasRecentlyObservedRealHungerProgress(CharacterAfflictions afflictions) { int instanceID = ((Object)afflictions).GetInstanceID(); if (TryReadCurrentIncrementalHunger(afflictions, out var currentIncrementalStatus)) { if (lastObservedRealHungerIncrementalStatuses.TryGetValue(instanceID, out var value) && currentIncrementalStatus > value) { lastRealHungerProgressTimes[instanceID] = Time.time; } lastObservedRealHungerIncrementalStatuses[instanceID] = currentIncrementalStatus; } if (lastRealHungerProgressTimes.TryGetValue(instanceID, out var value2)) { return Time.time - value2 <= 1f; } return false; } private static float GetHungerIncrementalStatus(CharacterAfflictions afflictions) { float fallbackHungerIncrementalStatus = GetFallbackHungerIncrementalStatus(afflictions); if (TryReadCurrentIncrementalHunger(afflictions, out var currentIncrementalStatus)) { return Mathf.Max(currentIncrementalStatus, fallbackHungerIncrementalStatus); } return fallbackHungerIncrementalStatus; } private static bool TryReadCurrentIncrementalHunger(CharacterAfflictions afflictions, out float currentIncrementalStatus) { currentIncrementalStatus = 0f; if (!(currentIncrementalStatusesField?.GetValue(afflictions) is float[] array)) { return false; } int num = 1; if (num < 0 || num >= array.Length) { return false; } currentIncrementalStatus = array[num]; return true; } private static float GetReductionRate(CharacterAfflictions afflictions, STATUSTYPE statusType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: 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_0020: Expected I4, but got Unknown if ((int)statusType != 3) { return (statusType - 6) switch { 2 => afflictions.hotReductionPerSecond, 4 => afflictions.sporesReductionPerSecond, 0 => afflictions.drowsyReductionPerSecond, _ => 0f, }; } return afflictions.poisonReductionPerSecond; } private static float GetCooldown(CharacterAfflictions afflictions, STATUSTYPE statusType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: 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_0020: Expected I4, but got Unknown if ((int)statusType != 3) { return (statusType - 6) switch { 2 => afflictions.hotReductionCooldown, 4 => afflictions.sporesReductionCooldown, 0 => afflictions.drowsyReductionCooldown, _ => 0f, }; } return afflictions.poisonReductionCooldown; } private static string FormatTime(float seconds) { if (seconds < 60f) { return Mathf.CeilToInt(seconds).ToString(); } if (seconds < 3600f) { int num = Mathf.FloorToInt(seconds / 60f); int num2 = Mathf.CeilToInt(seconds % 60f); return $"{num}:{num2:D2}"; } int num3 = Mathf.FloorToInt(seconds / 3600f); int num4 = Mathf.FloorToInt(seconds % 3600f / 60f); return $"{num3}:{num4:D2}"; } } } namespace PeakStatsEx.MonoBehaviours { internal sealed class CharacterBarAffliction : MonoBehaviour { internal STATUSTYPE afflictionType; internal bool isPetrify; private RectTransform rectTransform; private CharacterStaminaBar characterStaminaBar; internal float size; internal void FetchReferences() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown rectTransform = (RectTransform)((Component)this).transform; ((Component)((Component)this).transform.Find("Icon")).gameObject.SetActive(false); characterStaminaBar = ((Component)this).GetComponentInParent<CharacterStaminaBar>(); characterStaminaBar.AddCharacterBarAffliction(this); } internal void FetchDesiredSize() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) CharacterStaminaBar characterStaminaBar = this.characterStaminaBar; Character observedCharacter = characterStaminaBar.ObservedCharacter; if (!Object.op_Implicit((Object)(object)observedCharacter)) { return; } float num = (isPetrify ? ((float)observedCharacter.data.petrifyAmount / 100f) : observedCharacter.refs.afflictions.GetCurrentStatus(afflictionType)); size = this.characterStaminaBar.fullBarRectTransform.sizeDelta.x * num; if (num > 0.01f) { if (size < characterStaminaBar.minAfflictionWidth) { size = characterStaminaBar.minAfflictionWidth; } ((Component)this).gameObject.SetActive(true); } else { ((Component)this).gameObject.SetActive(false); } } internal void UpdateVisual() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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) RectTransform val = rectTransform; Vector2 sizeDelta = rectTransform.sizeDelta; sizeDelta.x = Mathf.Lerp(rectTransform.sizeDelta.x, size, Mathf.Min(Time.deltaTime * 10f, 0.1f)); val.sizeDelta = sizeDelta; } } internal sealed class CharacterStaminaBar : MonoBehaviour { private const float SampleScaleLow = 0.6f; private const float DefaultTeammateScale = 0.72f; private const float SampleScaleHigh = 1f; private const float DefaultTeammateVisualYOffset = 10f; private const float ExtraBarExpandedSize = 28f; private const float TeammateExtraStaminaFillOffsetX = 5f; internal const float ExtraStaminaBarWidthScale = 0.7f; internal const float PetrifyBarHeightScale = 0.5f; private static readonly Color defaultBarColor = new Color(0.1035f, 0.2656f, 0.3019f, 1f); private static readonly Color outOfStaminaColor = new Color(0.566f, 0.0089f, 0.0089f, 1f); private float minStaminaBarWidth = 20f; internal float minAfflictionWidth = 60f; internal RectTransform fullBarRectTransform; internal RectTransform staminaBarRectTransform; internal RectTransform maxStaminaBarRectTransform; internal RectTransform staminaBarOutlineRectTransform; internal RectTransform staminaBarOutlineOverflowBar; internal Image barImage; internal Image glowImage; internal RectTransform extraBar; internal RectTransform extraBarStamina; internal RectTransform extraBarOutline; internal GameObject shieldIcon; internal GameObject campfireIcon; private float staminaBarOffset; internal readonly List<CharacterBarAffliction> characterBarAfflictions = new List<CharacterBarAffliction>(); private CharacterBarAffliction? petrifyAffliction; private Coroutine? animateDisableCoroutine; private Character? _observedCharacter; private bool hadObservedCharacter; private bool outOfStamina; private bool sequencingExtraBar; private bool isEnabled; private float sinTime; private readonly float TAU = MathF.PI * 2f; private float desiredExtraStaminaSize; private float extraOutlineMaxWidth; private float extraBarDefaultVisualGap; private readonly List<InventorySlotUI> inventorySlotUIs = new List<InventorySlotUI>(); private readonly List<InventorySlotUI> backpackSlotUIs = new List<InventorySlotUI>(); private InventorySlotUI? heldItemSlot; private float appliedTeammateVisualYOffset; internal Character? ObservedCharacter { get { return _observedCharacter; } set { if ((Object)(object)value != (Object)null) { hadObservedCharacter = true; } _observedCharacter = value; if ((Object)(object)value != (Object)null) { ApplyTeammateVisualOffset(); } } } internal void AnimateEnable() { if (!isEnabled && animateDisableCoroutine == null) { isEnabled = true; ((Component)this).gameObject.SetActive(true); animateDisableCoroutine = ((MonoBehaviour)this).StartCoroutine(EnableIEnumerator()); } } internal void AnimateDisable() { if (isEnabled && animateDisableCoroutine == null) { isEnabled = false; animateDisableCoroutine = ((MonoBehaviour)this).StartCoroutine(DisableIEnumerator()); } } private void Awake() { Plugin.Logger.LogDebug((object)"[UpdateStaminaBar] CharacterStaminaBar Awake"); StaminaBar val = default(StaminaBar); if (((Component)this).TryGetComponent<StaminaBar>(ref val)) { staminaBarOffset = val.staminaBarOffset; minStaminaBarWidth = val.minStaminaBarWidth; minAfflictionWidth = val.minAfflictionWidth; DisableMoraleBoostUi(val); } CacheStaminaBarReferences(); CreateInventorySlots(); if ((Object)(object)val != (Object)null) { CreateExtraStaminaBar(val); if ((Object)(object)val.extraBar != (Object)null) { ((Component)val.extraBar).gameObject.SetActive(false); } } } private void Update() { if (!Object.op_Implicit((Object)(object)ObservedCharacter) || !((Component)ObservedCharacter).gameObject.activeSelf) { if (hadObservedCharacter) { Object.Destroy((Object)(object)((Component)this).gameObject); } return; } ApplyConfiguredScale(); ApplyTeammateVisualOffset(); ApplyExtraBarScaleCompensation(); UpdateStaminaBar(); UpdateExtraStaminaBar(); if (PluginConfig.ShowInventorySlots.Value) { UpdateInventorySlots(); } else { ClearInventorySlots(); } } private void CacheStaminaBarReferences() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown fullBarRectTransform = (RectTransform)((Component)this).transform.Find("FullBar"); maxStaminaBarRectTransform = (RectTransform)((Component)this).transform.Find("LayoutGroup/MaxStamina"); staminaBarOutlineRectTransform = (RectTransform)((Component)this).transform.Find("OutlineMask/Outline"); staminaBarOutlineOverflowBar = (RectTransform)((Component)this).transform.Find("OutlineOverflowLine"); barImage = ((Component)((Transform)maxStaminaBarRectTransform).Find("Back")).GetComponent<Image>(); staminaBarRectTransform = (RectTransform)((Component)barImage).transform.Find("Stamina"); glowImage = ((Component)((Transform)staminaBarRectTransform).Find("Glow")).GetComponent<Image>(); campfireIcon = ((Component)((Transform)staminaBarOutlineRectTransform).Find("CampfireIcon")).gameObject; shieldIcon = ((Component)((Transform)staminaBarOutlineRectTransform).Find("ShieldIcon")).gameObject; } private static void DisableMoraleBoostUi(StaminaBar original) { if ((Object)(object)original.moraleBoostAnimator != (Object)null) { ((Behaviour)original.moraleBoostAnimator).enabled = false; } if ((Object)(object)original.moraleBoostText != (Object)null) { ((Behaviour)original.moraleBoostText).enabled = false; ((Component)original.moraleBoostText).gameObject.SetActive(false); } } private void CreateExtraStaminaBar(StaminaBar original) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0242: 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_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0288: 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_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: 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_030d: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)fullBarRectTransform == (Object)null) { Plugin.Logger.LogDebug((object)"[CreateExtraStaminaBar] fullBar not found"); return; } GameObject val = new GameObject("FriendExtraBar"); val.transform.SetParent(((Component)this).transform, false); extraBar = val.AddComponent<RectTransform>(); RectTransform obj = extraBar; RectTransform obj2 = extraBar; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0f, 0.5f); obj2.anchorMax = val2; obj.anchorMin = val2; extraBar.pivot = new Vector2(0f, 0.5f); Vector2 anchoredPosition = fullBarRectTransform.anchoredPosition; extraBar.anchoredPosition = new Vector2(anchoredPosition.x, anchoredPosition.y - 31f); extraBarDefaultVisualGap = (fullBarRectTransform.anchoredPosition.y - extraBar.anchoredPosition.y) * 0.72f; extraBar.sizeDelta = Vector2.one * 28f; if ((Object)(object)original.extraBarOutline != (Object)null) { GameObject val3 = Object.Instantiate<GameObject>(((Component)original.extraBarOutline).gameObject, val.transform, false); ((Object)val3).name = "FriendExtraBarOutline"; extraBarOutline = val3.GetComponent<RectTransform>(); Vector2 anchoredPosition2 = extraBarOutline.anchoredPosition; extraBarOutline.anchoredPosition = new Vector2(anchoredPosition2.x - 46f, anchoredPosition2.y - 1f); extraOutlineMaxWidth = fullBarRectTransform.sizeDelta.x * 0.7f + 12f; extraBarOutline.sizeDelta = new Vector2(extraOutlineMaxWidth, extraBarOutline.sizeDelta.y); RemoveAllScriptsExcept<Image, RectTransform>(val3); RemoveCopiedStaminaInfo(val3); } if ((Object)(object)original.extraBarStamina != (Object)null) { GameObject val4 = Object.Instantiate<GameObject>(((Component)original.extraBarStamina).gameObject, val.transform, false); ((Object)val4).name = "FriendExtraBarStamina"; extraBarStamina = val4.GetComponent<RectTransform>(); ((Transform)extraBarStamina).SetParent((Transform)(object)extraBarOutline, false); RectTransform obj3 = extraBarStamina; RectTransform obj4 = extraBarStamina; ((Vector2)(ref val2))..ctor(0f, 0.5f); obj4.anchorMax = val2; obj3.anchorMin = val2; extraBarStamina.pivot = new Vector2(0f, 0.5f); extraBarStamina.anchoredPosition = Vector2.zero; ((Transform)extraBarStamina).localRotation = Quaternion.identity; ((Transform)extraBarStamina).localScale = Vector3.one; extraBarStamina.offsetMin = new Vector2(0f, extraBarStamina.offsetMin.y); Transform obj5 = val4.transform.Find("Stamina"); RectTransform val5 = (RectTransform)(object)((obj5 is RectTransform) ? obj5 : null); if (val5 != null) { val5.anchoredPosition = new Vector2(val5.anchoredPosition.x + 5f, val5.anchoredPosition.y); val5.sizeDelta = new Vector2(val5.sizeDelta.x, val5.sizeDelta.y * 0.5f); } RemoveAllScriptsExcept<Image, RectTransform>(val4); RemoveCopiedStaminaInfo(val4); } CreateOrMovePetrifyAffliction(); val.SetActive(false); } private void CreateOrMovePetrifyAffliction() { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00cf: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)petrifyAffliction == (Object)null && (Object)(object)GUIManager.instance.bar.petrifyAffliction != (Object)null) { BarAffliction val = GUIManager.instance.bar.petrifyAffliction; GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject, (Transform)(object)extraBarOutline, false); ((Object)val2).name = "FriendPetrifyAffliction"; RemoveAllScriptsExcept<Image, RectTransform>(val2); petrifyAffliction = val2.AddComponent<CharacterBarAffliction>(); petrifyAffliction.afflictionType = val.afflictionType; petrifyAffliction.isPetrify = true; petrifyAffliction.FetchReferences(); } if ((Object)(object)petrifyAffliction != (Object)null) { RectTransform val3 = (RectTransform)((Component)petrifyAffliction).transform; ((Transform)val3).SetParent((Transform)(object)extraBarOutline, false); Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(1f, 0.5f); val3.anchorMax = val4; val3.anchorMin = val4; val3.pivot = new Vector2(1f, 0.5f); val3.anchoredPosition = new Vector2(-8f, 0f); ((Transform)val3).localRotation = Quaternion.identity; ((Transform)val3).localScale = new Vector3(0.7f, 0.5f, 1f); ((Transform)val3).SetAsLastSibling(); } } private void UpdateExtraStaminaBar() { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_010e: 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_0165: 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_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Expected O, but got Unknown if ((Object)(object)extraBar == (Object)null || (Object)(object)extraBarStamina == (Object)null || (Object)(object)extraBarOutline == (Object)null || (Object)(object)ObservedCharacter == (Object)null) { return; } float extraStamina = ObservedCharacter.data.extraStamina; bool flag = (Object)(object)petrifyAffliction != (Object)null && (float)ObservedCharacter.data.petrifyAmount > 1f; bool flag2 = extraStamina > 0f || flag; if (!((Component)extraBar).gameObject.activeSelf && flag2) { extraBar.sizeDelta = Vector2.zero; ShortcutExtensions.DOKill((Component)(object)extraBar, false); TweenSettingsExtensions.SetEase<TweenerCore<Vector2, Vector2, VectorOptions>>(DOTweenModuleUI.DOSizeDelta(extraBar, Vector2.one * 28f, 0.25f, false), (Ease)9); ((Component)extraBar).gameObject.SetActive(true); } if (((Component)extraBar).gameObject.activeSelf) { desiredExtraStaminaSize = Mathf.Max(0f, extraStamina * fullBarRectTransform.sizeDelta.x * 0.7f); extraBarStamina.sizeDelta = new Vector2(Mathf.Lerp(extraBarStamina.sizeDelta.x, Mathf.Max(4f, desiredExtraStaminaSize), Time.deltaTime * 10f), extraBarStamina.sizeDelta.y); ((Component)extraBarStamina).gameObject.SetActive(extraBarStamina.sizeDelta.x > 6.1f); extraBarOutline.sizeDelta = new Vector2(extraOutlineMaxWidth, extraBarOutline.sizeDelta.y); if (!flag2 && !sequencingExtraBar) { sequencingExtraBar = true; TweenSettingsExtensions.OnComplete<Sequence>(TweenSettingsExtensions.Append(DOTween.Sequence(), (Tween)(object)DOTweenModuleUI.DOSizeDelta(extraBar, new Vector2(extraBar.sizeDelta.x, 0f), 0.2f, false)), new TweenCallback(DisableExtraBar)); } } } private void DisableExtraBar() { ((Component)extraBar).gameObject.SetActive(false); sequencingExtraBar = false; } private static void RemoveAllScriptsExcept<T1, T2>(GameObject gameObject) { MonoBehaviour[] components = gameObject.GetComponents<MonoBehaviour>(); MonoBehaviour[] array = components; foreach (MonoBehaviour val in array) { if (((object)val).GetType() != typeof(T1) && ((object)val).GetType() != typeof(T2)) { Object.DestroyImmediate((Object)(object)val); } } } private static void RemoveCopiedStaminaInfo(GameObject gameObject) { Transform[] componentsInChildren = gameObject.GetComponentsInChildren<Transform>(true); Transform[] array = componentsInChildren; foreach (Transform val in array) { if ((Object)(object)val != (Object)(object)gameObject.transform && ((Object)val).name == "StaminaInfo") { Object.DestroyImmediate((Object)(object)((Component)val).gameObject); } } } internal void AddCharacterBarAffliction(CharacterBarAffliction characterBarAffliction) { characterBarAfflictions.Add(characterBarAffliction); if (characterBarAffliction.isPetrify) { petrifyAffliction = characterBarAffliction; } } private void CreateInventorySlots() { //IL_0026: 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_0063: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) GUIManager instance = GUIManager.instance; Sprite sprite = instance.items[0].selectedSlotIcon.sprite; Color color = ((Graphic)instance.items[0].selectedSlotIcon).color; Transform label = FindNicknameLabel(); float num = GetNicknameLabelWidth(label) + 184f; for (int i = 0; i < 3; i++) { InventorySlotUI item = CreateInventorySlot($"InvSlot_{i}", new Vector2(32f, 32f), new Vector2(num + (float)(i * 38), 43f), sprite, color); inventorySlotUIs.Add(item); } heldItemSlot = CreateInventorySlot("HoldingItemSlot", new Vector2(38f, 38f), new Vector2(num + 114f, 43f), sprite, color); for (int j = 0; j < 4; j++) { InventorySlotUI item2 = CreateInventorySlot($"BackpackSlot_{j}", new Vector2(32f, 32f), new Vector2(num + 170f + (float)(j * 38), 43f), sprite, color); backpackSlotUIs.Add(item2); } } private void UpdateInventorySlots() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown Character? observedCharacter = ObservedCharacter; if (((observedCharacter == null) ? null : observedCharacter.player?.itemSlots) == null) { ClearInventorySlots(); return; } ItemSlot[] itemSlots = ObservedCharacter.player.itemSlots; Optionable<byte> currentSelectedSlot = ObservedCharacter.refs.items.currentSelectedSlot; for (int i = 0; i < inventorySlotUIs.Count && i < itemSlots.Length; i++) { bool selected = currentSelectedSlot.IsSome && currentSelectedSlot.Value == i; inventorySlotUIs[i].SetItem(itemSlots[i], selected); } Item currentItem = ObservedCharacter.data.currentItem; if ((Object)(object)heldItemSlot != (Object)null) { ItemSlot slot = new ItemSlot(byte.MaxValue) { prefab = currentItem }; heldItemSlot.SetItem(slot, selected: true); } if (!((ItemSlot)ObservedCharacter.player.backpackSlot).IsEmpty()) { BackpackData val = default(BackpackData); ((ItemSlot)ObservedCharacter.player.backpackSlot).data.TryGetDataEntry<BackpackData>((DataEntryKey)7, ref val); ItemSlot[] itemSlots2 = val.itemSlots; for (int j = 0; j < backpackSlotUIs.Count && j < itemSlots2.Length; j++) { backpackSlotUIs[j].SetItem(itemSlots2[j], selected: false); } return; } foreach (InventorySlotUI backpackSlotUI in backpackSlotUIs) { backpackSlotUI.Clear(); } } private void ClearInventorySlots() { foreach (InventorySlotUI inventorySlotUI in inventorySlotUIs) { inventorySlotUI.Clear(); } heldItemSlot?.Clear(); } private void ApplyTeammateVisualOffset() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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) float teammateVisualYOffset = GetTeammateVisualYOffset(); float num = teammateVisualYOffset - appliedTeammateVisualYOffset; if (Mathf.Abs(num) < 0.001f) { return; } appliedTeammateVisualYOffset = teammateVisualYOffset; for (int i = 0; i < ((Component)this).transform.childCount; i++) { Transform child = ((Component)this).transform.GetChild(i); RectTransform val = (RectTransform)(object)((child is RectTransform) ? child : null); if (val != null) { val.anchoredPosition += new Vector2(0f, num); } } } private static float GetTeammateVisualYOffset() { return 10f + InterpolateScaleSetting(10f, -1f, -21f); } private void ApplyConfiguredScale() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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) if (isEnabled && animateDisableCoroutine == null) { float configuredScale = GetConfiguredScale(); if (!(Mathf.Abs(((Component)this).transform.localScale.x - configuredScale) < 0.001f)) { ShortcutExtensions.DOKill((Component)(object)((Component)this).transform, false); ((Component)this).transform.localScale = Vector3.one * configuredScale; } } } private void ApplyExtraBarScaleCompensation() { //IL_006e: 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_008a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)extraBar == (Object)null) && !((Object)(object)fullBarRectTransform == (Object)null) && !(extraBarDefaultVisualGap <= 0f)) { float num = Mathf.Max(0f, extraBarDefaultVisualGap + InterpolateScaleSetting(-3f, 0f, 10f)); float num2 = num / Mathf.Max(0.001f, GetConfiguredScale()); extraBar.anchoredPosition = new Vector2(extraBar.anchoredPosition.x, fullBarRectTransform.anchoredPosition.y - num2); } } internal static float GetConfiguredScale() { return Mathf.Clamp(PluginConfig.TeammateStaminaBarScale.Value, 0.2f, 1f); } internal static float GetGroupSpacing() { return Mathf.Max(0f, InterpolateScaleSetting(26.8f, 38f, 65.8f)); } private static float InterpolateScaleSetting(float valueAtScaleLow, float valueAtDefaultScale, float valueAtScaleHigh) { float configuredScale = GetConfiguredScale(); float num = (configuredScale - 0.72f) * (configuredScale - 1f) / 0.048f; float num2 = (configuredScale - 0.6f) * (configuredScale - 1f) / -0.0336f; float num3 = (configuredScale - 0.6f) * (configuredScale - 0.72f) / 0.11199998f; return valueAtScaleLow * num + valueAtDefaultScale * num2 + valueAtScaleHigh * num3; } private InventorySlotUI CreateInventorySlot(string name, Vector2 size, Vector2 position, Sprite borderSprite, Color borderColor) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(((Component)this).transform, false); RectTransform component = val.GetComponent<RectTransform>(); component.sizeDelta = size; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0f, 0.5f); component.anchorMax = val2; Vector2 anchorMin = val2; component.anchorMin = anchorMin; component.pivot = new Vector2(0f, 0.5f); component.anchoredPosition = position; InventorySlotUI inventorySlotUI = val.AddComponent<InventorySlotUI>(); inventorySlotUI.Initialize(borderSprite, borderColor); return inventorySlotUI; } private Transform? FindNicknameLabel() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown foreach (Transform item in ((Component)this).transform) { Transform val = item; if (((Object)val).name.StartsWith("CharacterName")) { return val; } } return null; } private float GetNicknameLabelWidth(Transform? label) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)label)) { return 100f; } return ((Component)label).GetComponent<RectTransform>().sizeDelta.x; } private void UpdateStaminaBar() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: 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) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ObservedCharacter == (Object)null) { Plugin.Logger.LogDebug((object)"[UpdateStaminaBar] observedCharacter not found"); return; } foreach (CharacterBarAffliction characterBarAffliction in characterBarAfflictions) { characterBarAffliction.FetchDesiredSize(); characterBarAffliction.UpdateVisual(); } float num = Mathf.Max(0f, ObservedCharacter.data.currentStamina * fullBarRectTransform.sizeDelta.x + staminaBarOffset); if (ObservedCharacter.data.currentStamina <= 0.005f && !outOfStamina) { outOfStamina = true; OutOfStaminaPulse(); } else if (ObservedCharacter.data.currentStamina > 0.005f) { outOfStamina = false; } float num2 = Time.deltaTime * 10f; staminaBarRectTransform.sizeDelta = new Vector2(Mathf.Lerp(staminaBarRectTransform.sizeDelta.x, num, num2), staminaBarRectTransform.sizeDelta.y); float num3 = Mathf.Clamp01((staminaBarRectTransform.sizeDelta.x - num) * 0.5f); sinTime += num2 * num3; Color color = ((Graphic)glowImage).color; color.a = num3 * 0.4f - Mathf.Abs(Mathf.Sin(sinTime)) * 0.2f; ((Graphic)glowImage).color = color; float num4 = Mathf.Max(0f, ObservedCharacter.GetMaxStamina() * fullBarRectTransform.sizeDelta.x + staminaBarOffset); maxStaminaBarRectTransform.sizeDelta = new Vector2(Mathf.Lerp(maxStaminaBarRectTransform.sizeDelta.x, num4, num2), maxStaminaBarRectTransform.sizeDelta.y); float statusSum = ObservedCharacter.refs.afflictions.statusSum; staminaBarOutlineRectTransform.sizeDelta = new Vector2(14f + Mathf.Max(1f, statusSum) * fullBarRectTransform.sizeDelta.x, staminaBarOutlineRectTransform.sizeDelta.y); ((Component)staminaBarOutlineOverflowBar).gameObject.SetActive(statusSum > 1.005f); ((Component)staminaBarRectTransform).gameObject.SetActive(staminaBarRectTransform.sizeDelta.x > minStaminaBarWidth); ((Component)maxStaminaBarRectTransform).gameObject.SetActive(maxStaminaBarRectTransform.sizeDelta.x > minStaminaBarWidth); if (sinTime > TAU) { sinTime -= TAU; } shieldIcon.SetActive(ObservedCharacter.data.isInvincible); campfireIcon.SetActive(!ObservedCharacter.refs.afflictions.canGetHungry); } private void OutOfStaminaPulse() { //IL_0006: 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) ((Graphic)barImage).color = outOfStaminaColor; DOTweenModuleUI.DOColor(barImage, defaultBarColor, 0.5f); } private IEnumerator EnableIEnumerator() { ((Component)this).transform.localScale = Vector3.zero; TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOScale(((Component)this).transform, GetConfiguredScale(), 0.5f), (Ease)24); yield return (object)new WaitForSeconds(0.5f); animateDisableCoroutine = null; } private IEnumerator DisableIEnumerator() { ((Component)this).transform.localScale = Vector3.one * GetConfiguredScale(); TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOScale(((Component)this).transform, 0f, 0.5f), (Ease)17); yield return (object)new WaitForSeconds(0.5f); ((Component)this).gameObject.SetActive(false); animateDisableCoroutine = null; } } public class InventorySlotUI : MonoBehaviour { private RectTransform rectTransform; private RawImage icon; private Image fill; private GameObject? fuelBar; private Image? fuelBarFill; private Vector2 startingSizeDelta; private Item? currentItem; private ItemInstanceData? currentData; public void Initialize(Sprite selectedSprite, Color selectedColor) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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) rectTransform = ((Component)this).GetComponent<RectTransform>(); startingSizeDelta = rectTransform.sizeDelta; CreateFuelBar(); icon = ((Component)this).gameObject.AddComponent<RawImage>(); ((Graphic)icon).color = new Color(1f, 1f, 1f, 0f); ((Graphic)icon).raycastTarget = false; fill = CreateFillImage("Fill", selectedSprite, selectedColor); ((Behaviour)fill).enabled = false; } public void SetItem(ItemSlot slot, bool selected) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (!slot.IsEmpty() && slot.prefab?.UIData != null) { currentItem = slot.prefab; currentData = slot.data; if (currentItem?.UIData != null) { icon.texture = (Texture)(object)currentItem.UIData.GetIcon(); ((Behaviour)icon).enabled = true; ((Graphic)icon).color = Color.white; } UpdateCookedColor(); UpdateFuelBar(); } else { Clear(); } SetSelected(selected); } public void Clear() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)fill).enabled = false; ((Behaviour)icon).enabled = false; icon.texture = null; ((Graphic)icon).color = new Color(1f, 1f, 1f, 0f); currentItem = null; currentData = null; if (Object.op_Implicit((Object)(object)fuelBar)) { fuelBar.SetActive(false); } } private void SetSelected(bool isSelected) { //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_00b9: 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_0066: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)currentItem != (Object)null || isSelected) { if (isSelected) { ShortcutExtensions.DOKill((Component)(object)rectTransform, false); TweenSettingsExtensions.SetEase<TweenerCore<Vector2, Vector2, VectorOptions>>(DOTweenModuleUI.DOSizeDelta(rectTransform, startingSizeDelta * 1.2f, 0.5f, false), (Ease)24); ((Behaviour)fill).enabled = true; ((Component)fill).transform.localScale = Vector3.zero; ShortcutExtensions.DOKill((Component)(object)((Component)fill).transform, false); TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOScale(((Component)fill).transform, 1f, 0.25f), (Ease)9); } else { ShortcutExtensions.DOKill((Component)(object)rectTransform, false); TweenSettingsExtensions.SetEase<TweenerCore<Vector2, Vector2, VectorOptions>>(DOTweenModuleUI.DOSizeDelta(rectTransform, startingSizeDelta, 0.2f, false), (Ease)9); ((Behaviour)fill).enabled = false; } } else if (isSelected) { ShortcutExtensions.DOKill((Component)(object)rectTransform, false); Sequence val = DOTween.Sequence(); TweenSettingsExtensions.Append(val, (Tween)(object)TweenSettingsExtensions.SetEase<TweenerCore<Vector2, Vector2, VectorOptions>>(DOTweenModuleUI.DOSizeDelta(rectTransform, startingSizeDelta * 1.2f, 0.075f, false), (Ease)9)); TweenSettingsExtensions.Append(val, (Tween)(object)TweenSettingsExtensions.SetEase<TweenerCore<Vector2, Vector2, VectorOptions>>(DOTweenModuleUI.DOSizeDelta(rectTransform, startingSizeDelta, 0.125f, false), (Ease)2)); } else { ShortcutExtensions.DOKill((Component)(object)rectTransform, false); rectTransform.sizeDelta = startingSizeDelta; } } private void UpdateCookedColor() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) ItemInstanceData val = currentData; IntItemData val2 = default(IntItemData); if (val != null && val.TryGetDataEntry<IntItemData>((DataEntryKey)1, ref val2)) { ((Graphic)icon).color = ItemCooking.GetCookColor(val2.Value); } } private void UpdateFuelBar() { if ((Object)(object)fuelBar == (Object)null) { return; } if ((Object)(object)Character.observedCharacter != (Object)(object)Character.localCharacter) { fuelBar.SetActive(false); return; } ItemInstanceData val = currentData; FloatItemData val2 = default(FloatItemData); if (val != null && val.TryGetDataEntry<FloatItemData>((DataEntryKey)11, ref val2)) { fuelBar.SetActive(true); if ((Object)(object)fuelBarFill != (Object)null) { fuelBarFill.fillAmount = val2.Value; } } else { fuelBar.SetActive(false); if ((Object)(object)fuelBarFill != (Object)null) { fuelBarFill.fillAmount = 1f; } } } private Image CreateFillImage(string name, Sprite sprite, Color color) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(((Component)this).transform, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; component.anchoredPosition = Vector2.zero; Image val2 = val.AddComponent<Image>(); val2.sprite = sprite; val2.type = (Type)1; ((Graphic)val2).color = color; ((Graphic)val2).raycastTarget = false; return val2; } private void CreateFuelBar() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00f0: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("FuelBar", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(((Component)this).transform, false); val.transform.SetAsFirstSibling(); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0f); component.anchorMax = new Vector2(1f, 0f); component.sizeDelta = new Vector2(0f, 4f); component.anchoredPosition = new Vector2(0f, 2f); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = new Color(0f, 0f, 0f, 0.5f); Sprite sprite = (val2.sprite = CreateWhiteSprite()); val2.type = (Type)1; GameObject val4 = new GameObject("Fill", new Type[1] { typeof(RectTransform) }); val4.transform.SetParent(val.transform, false); RectTransform component2 = val4.GetComponent<RectTransform>(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.sizeDelta = Vector2.zero; component2.anchoredPosition = Vector2.zero; fuelBarFill = val4.AddComponent<Image>(); ((Graphic)fuelBarFill).color = Color.yellow; fuelBarFill.sprite = sprite; fuelBarFill.type = (Type)3; fuelBarFill.fillMethod = (FillMethod)0; fuelBarFill.fillOrigin = 0; fuelBar = val; fuelBar.SetActive(false); } private Sprite CreateWhiteSprite() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, Color.white); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), Vector2.one * 0.5f); } private void OnDisable() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = rectTransform; if (obj != null) { ShortcutExtensions.DOKill((Component)(object)obj, false); } Image obj2 = fill; if (obj2 != null) { Transform transform = ((Component)obj2).transform; if (transform != null) { ShortcutExtensions.DOKill((Component)(object)transform, false); } } if (Object.op_Implicit((Object)(object)rectTransform)) { rectTransform.sizeDelta = startingSizeDelta; } if (Object.op_Implicit((Object)(object)fill)) { ((Behaviour)fill).enabled = false; } } } internal sealed class MapStats : MonoBehaviour { internal static string currentLevelName = ""; internal static int currentLevelIndex = -1; private static string currentBiomesNames = ""; private static int todayLevelIndex = -1; private static int currentMapSeed = -1; private TMP_Text tmpText; private MapBaker mapBaker; private MapHandler mapHandler; private NextLevelService nextLevelService; private void Awake() { mapBaker = SingletonAsset<MapBaker>.Instance; mapHandler = Singleton<MapHandler>.Instance; nextLevelService = GameHandler.GetService<NextLevelService>(); if (TerrainRandomiserCompatibility.Enabled) { MapSettings mapSettings = TerrainRandomiserCompatibility.GetMapSettings(); currentMapSeed = TerrainRandomiserCompatibility.GetRandomizerSeed(mapSettings); Plugin.Logger.LogInfo((object)$"Current map seed from TerrainRandomiser: {currentMapSeed}"); } else if (TerrainCustomiserCompatibility.Enabled) { currentMapSeed = TerrainCustomiserCompatibility.GetCustomiserSeed(); Plugin.Logger.LogInfo((object)$"Current map seed from TerrainCustomiser: {currentMapSeed}"); } } private void Start() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) tmpText = ((Component)this).GetComponent<TMP_Text>(); tmpText.autoSizeTextContainer = true; tmpText.textWrappingMode = (TextWrappingModes)0; tmpText.alignment = (TextAlignmentOptions)260; tmpText.lineSpacing = -20f; tmpText.fontSize = 22f; tmpText.outlineColor = new Color32((byte)0, (byte)0, (byte)0, byte.MaxValue); tmpText.outlineWidth = 0.055f; } private unsafe void Update() { try { Character localCharacter = Character.localCharacter; if (!Object.op_Implicit((Object)(object)tmpText) || !Object.op_Implicit((Object)(object)localCharacter)) { return; } if (nextLevelService.Data.IsSome && todayLevelIndex == -1) { int num = nextLevelService.NextLevelIndexOrFallback + NextLevelService.debugLevelIndexOffset; todayLevelIndex = num % mapBaker.ScenePaths.Length; Plugin.Logger.LogInfo((object)$"todayLevelIndex set to {todayLevelIndex}"); } if (currentLevelIndex == -1) { int num2 = LevelNameToIndex(currentLevelName); if (num2 != -1) { currentLevelIndex = num2; } else if (todayLevelIndex != -1) { currentLevelIndex = todayLevelIndex; } Plugin.Logger.LogInfo((object)$"currentLevelIndex set to {currentLevelIndex}"); } string text = string.Empty; if (PluginConfig.DisplayLevel.Value && currentLevelIndex != -1) { currentLevelName = GetLevelName(currentLevelIndex); text = text + "(" + currentLevelName + ")"; } if (PluginConfig.DisplayBiomes.Value) { IEnumerable<string> values = mapHandler.biomes.Where((BiomeType x) => (int)x != 0 && (int)x != 5).SelectMany(delegate(BiomeType x) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)x == 3) { return new string[2] { LocalizedText.GetText("CALDERA", true), LocalizedText.GetText("THE KILN", true) }; } return ((int)x == 8) ? new string[2] { LocalizedText.GetText("GLOOM", true), LocalizedText.GetText("THE CITADEL", true) } : new string[1] { LocalizedText.GetText(((object)(*(BiomeType*)(&x))/*cast due to .constrained prefix*/).ToString(), true) }; }); currentBiomesNames = string.Join(", ", values); text = text + "[" + currentBiomesNames + "]"; } if ((PluginConfig.DisplayTerrainRandomiserSeed.Value || PluginConfig.DisplayTerrainCustomiserSeed.Value) && currentMapSeed != -1) { text += $"<{currentMapSeed}>"; } tmpText.text = text; } catch (Exception ex) { Plugin.Logger.LogInfo((object)ex.ToString()); } } private string GetLevelName(int levelIndex) { levelIndex %= mapBaker.ScenePaths.Length; return PathUtil.WithoutExtensions(PathUtil.GetFileName(mapBaker.ScenePaths[levelIndex])); } private int LevelNameToIndex(string levelName) { for (int i = 0; i < mapBaker.ScenePaths.Length; i++) { string levelName2 = GetLevelName(i); if (string.Equals(levelName2, levelName, StringComparison.OrdinalIgnoreCase)) { return i; } } return -1; } } internal sealed class ProximityStaminaManager : MonoBehaviour { private readonly Dictionary<Character, CharacterStaminaBa