Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of WiresNotificationOverhaul v1.1.11
WiresNotificationOverhaul.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("WiresNotificationOverhaul")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+43318fad95c723ca3c84b152d329b55db0728a65")] [assembly: AssemblyProduct("WiresNotificationOverhaul")] [assembly: AssemblyTitle("WiresNotificationOverhaul")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 WiresNotificationOverhaul { internal static class BuildingRepairCapture { [ThreadStatic] private static Piece _target; internal static void Begin(Player player) { _target = (((Object)(object)player != (Object)null && (Object)(object)player == (Object)(object)Player.m_localPlayer) ? player.GetHoveringPiece() : null); } internal static void End() { _target = null; } internal static bool TryGetMessage(MessageType type, string text, out Sprite icon, out string shortText) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 icon = null; shortText = null; Piece target = _target; if ((int)type != 1 || (Object)(object)target == (Object)null || string.IsNullOrEmpty(text) || Localization.instance == null) { return false; } string b = Localization.instance.Localize("$msg_repaired", new string[1] { target.m_name }); string text2 = target.m_name + " $msg_doesnotneedrepair"; string b2 = Localization.instance.Localize(text2); if (string.Equals(text, b, StringComparison.Ordinal)) { shortText = "Repaired"; } else { if (!string.Equals(text, text2, StringComparison.Ordinal) && !string.Equals(text, b2, StringComparison.Ordinal)) { return false; } shortText = "No repair needed"; } icon = target.m_icon; return true; } } [HarmonyPatch(typeof(Player), "Repair")] internal static class BuildingRepairCapturePatch { [HarmonyPrefix] private static void Prefix(Player __instance) { BuildingRepairCapture.Begin(__instance); } [HarmonyFinalizer] private static Exception Finalizer(Exception __exception) { BuildingRepairCapture.End(); return __exception; } } internal static class CompactFormat { internal enum Kind { Other, Pickup, Removed, Dropped, Broken, Level, FortifiedLevel, Rested, Resting, Pin, AutoPickup, Walk, PotionExpired, PotionAvailable, NewUnlocks, InventoryFull, OutOf, MissingRequirement, NeedFire, NeedStation, StackAll, NothingToStack, SkillsLowered, JoinCodeCopied } private static readonly Regex LevelAtEnd = new Regex("(?:[: ]\\s*)(\\d+)\\s*$", RegexOptions.Compiled); private static readonly Regex ComfortLevel = new Regex("(?:comfort\\s*:\\s*|:\\s*)(\\d+)\\s*\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly string[] SimpleStatusLabels = new string[12] { "Freezing", "Cold", "Wet", "Poisoned", "Burning", "Warm", "Sheltered", "Smoked", "Exposed", "Comfortable", "Rested", "Hunted" }; internal static Kind Detect(string raw, string localized) { string text = raw ?? ""; string text2 = localized ?? ""; if (text.IndexOf("$inventory_logs_new", StringComparison.Ordinal) >= 0) { return Kind.NewUnlocks; } if (text == "$inventory_full") { return Kind.InventoryFull; } if (text.StartsWith("$msg_outof ", StringComparison.Ordinal)) { return Kind.OutOf; } switch (text) { case "$msg_missingrequirement": return Kind.MissingRequirement; case "$msg_needfire": return Kind.NeedFire; case "$msg_missingstation": return Kind.NeedStation; default: if (text.StartsWith("$msg_stackall ", StringComparison.Ordinal)) { return Kind.StackAll; } switch (text) { case "$msg_stackall_none": return Kind.NothingToStack; case "$msg_skills_lowered": return Kind.SkillsLowered; case "$menu_joincode_copied": return Kind.JoinCodeCopied; default: if (text.StartsWith("$msg_added ", StringComparison.Ordinal)) { return Kind.Pickup; } if (text.StartsWith("$msg_removed ", StringComparison.Ordinal)) { return Kind.Removed; } if (text.StartsWith("$msg_dropped ", StringComparison.Ordinal)) { return Kind.Dropped; } if (text.StartsWith("$msg_pin_added", StringComparison.Ordinal)) { return Kind.Pin; } if (text.StartsWith("$hud_autopickup", StringComparison.Ordinal)) { return Kind.AutoPickup; } if (text.StartsWith("$msg_walk ", StringComparison.Ordinal)) { return Kind.Walk; } if (text.IndexOf("$msg_broke", StringComparison.Ordinal) >= 0) { return Kind.Broken; } if (text.StartsWith("$msg_skillup ", StringComparison.Ordinal)) { return Kind.Level; } if (text.StartsWith("Fortified skill improved ", StringComparison.OrdinalIgnoreCase)) { return Kind.FortifiedLevel; } if (text.IndexOf("$se_rested_start", StringComparison.Ordinal) >= 0 || text2.StartsWith("You are now feeling rested", StringComparison.OrdinalIgnoreCase)) { return Kind.Rested; } if (text.IndexOf("$se_resting", StringComparison.Ordinal) >= 0 || string.Equals(text2.Trim(), "Resting", StringComparison.OrdinalIgnoreCase)) { return Kind.Resting; } return Kind.Other; } } } internal static string Text(Kind kind, string original, string localized, int amount, bool compact, string fortifiedBlue = "#79B9F0") { if (compact && !CompactLocalization.IsEnglish) { switch (kind) { case Kind.Pickup: if (amount <= 0) { return localized; } return "+" + amount; case Kind.Removed: case Kind.Dropped: if (amount <= 0) { return localized; } return "-" + amount; case Kind.Level: case Kind.FortifiedLevel: return SkillLevelText(kind, original, localized, compact: false, fortifiedBlue); default: if (amount <= 1) { return localized; } return localized + " x" + amount; } } if (kind == Kind.Level || kind == Kind.FortifiedLevel) { return SkillLevelText(kind, original, localized, compact, fortifiedBlue); } if (compact) { switch ((original ?? "").Trim()) { case "$msg_stationneedroof": return "Requires roof"; case "$msg_stationtooexposed": return "Requires shelter"; case "$msg_missingstation": return "Requires station"; case "$msg_needfire": return "Requires nearby fire"; case "$msg_nobuildzone": return "Can't build here"; case "$msg_privatezone": return "Private area"; case "$msg_cantremovenow": return "Can't remove now"; case "$msg_blocked": return "Blocked"; case "$msg_needspace": return "Need space"; case "$msg_noteleportarea": return "Needs stone circle"; case "$msg_invalidplacement": return "Invalid placement"; case "$msg_extensionmissingstation": return "Requires station"; case "$msg_wrongbiome": return "Wrong biome"; case "$msg_needcultivated": return "Requires cultivated ground"; case "$msg_needdirt": return "Requires dirt"; case "$msg_notindungeon": return "Can't build in dungeon"; case "$msg_snowtoodeep": return "Snow too deep"; case "$msg_nosnow": return "Requires snow"; } } if (!compact) { if (amount <= 1) { return localized; } return localized + " x" + amount; } switch (kind) { case Kind.NewUnlocks: { Match match2 = Regex.Match(original ?? "", "^\\s*(\\d+)\\s+\\$inventory_logs_new\\s*$"); if (!match2.Success) { return localized; } return "+" + match2.Groups[1].Value + " new unlocks"; } case Kind.InventoryFull: return "Inventory full"; case Kind.OutOf: return localized; case Kind.MissingRequirement: return "Missing requirement"; case Kind.NeedFire: if (!Regex.IsMatch(localized ?? "", "^You need a fire nearby[.!]?$", RegexOptions.IgnoreCase)) { return localized; } return "Need nearby fire"; case Kind.NeedStation: return ShortenMessage(localized); case Kind.StackAll: return ShortenMessage(localized); case Kind.NothingToStack: return "Nothing to stack"; case Kind.SkillsLowered: return "Skills lowered"; case Kind.JoinCodeCopied: return "Join code copied"; case Kind.Pickup: if (amount <= 0) { return localized; } return "+" + amount; case Kind.Removed: case Kind.Dropped: if (amount <= 0) { return localized; } return "-" + amount; case Kind.Broken: return "Broken"; case Kind.Rested: { Match match = ComfortLevel.Match(original ?? ""); if (!match.Success) { match = ComfortLevel.Match(localized ?? ""); } if (!match.Success) { return "Rested"; } return "Rested (" + match.Groups[1].Value + ")"; } case Kind.Resting: return "Resting"; case Kind.Pin: return ShortenMessage(localized); case Kind.AutoPickup: return ShortenMessage(localized); case Kind.Walk: return ShortenMessage(localized); case Kind.PotionExpired: return "Expired"; case Kind.PotionAvailable: return "Available"; default: { string text = ShortenMessage(localized); if (amount <= 1) { return text; } return text + " x" + amount; } } } internal static string ShortenMessage(string original) { if (string.IsNullOrWhiteSpace(original)) { return original; } string text = original.Trim(); if (!CompactLocalization.IsEnglish) { return text; } string text2 = text; char c = text2[text2.Length - 1]; if (c == '.' || c == '!') { text2 = text2.Substring(0, text2.Length - 1); } string text3 = SimplifyStatusSentence(text); if (text3 != text) { return text3; } if (CompactV11.TryFormat(text, out var compact)) { return compact; } int num; int num2; if (text2.IndexOf("achiev", StringComparison.OrdinalIgnoreCase) >= 0) { num = (Regex.IsMatch(text2, "achieve?ments?", RegexOptions.IgnoreCase) ? 1 : 0); if (num != 0) { num2 = (Regex.IsMatch(text2, "disabl|no longer (?:earn|get)|cannot (?:earn|get)|won.t (?:earn|get)", RegexOptions.IgnoreCase) ? 1 : 0); goto IL_0094; } } else { num = 0; } num2 = 0; goto IL_0094; IL_0094: bool flag = (byte)num2 != 0; bool flag2 = text2.IndexOf("cheat", StringComparison.OrdinalIgnoreCase) >= 0 && Regex.IsMatch(text2, "cheat(?:ed|ing)?\\s+(?:item|pickup)|(?:item|pickup).*cheat", RegexOptions.IgnoreCase); if ((((uint)num & (flag ? 1u : 0u)) | (flag2 ? 1u : 0u)) != 0) { return "Achievements disabled"; } if (text2.IndexOf("world", StringComparison.OrdinalIgnoreCase) >= 0 && text2.IndexOf("sav", StringComparison.OrdinalIgnoreCase) >= 0 && Regex.IsMatch(text2, "(?:world\\s+(?:has\\s+been\\s+)?saved|saved\\s+(?:the\\s+)?world)", RegexOptions.IgnoreCase)) { Match match = Regex.Match(text2, "\\b\\d+(?:[\\.,]\\d+)?\\s*(?:ms|milliseconds?|s|sec|seconds?)\\b", RegexOptions.IgnoreCase); if (!match.Success) { return "World saved"; } return "World saved (" + match.Value.Replace(" ", "") + ")"; } if (!text2.StartsWith("You ", StringComparison.OrdinalIgnoreCase)) { if (text2.StartsWith("Automatic pickup", StringComparison.OrdinalIgnoreCase) && Regex.IsMatch(text2, "^automatic pickup\\s*:\\s*", RegexOptions.IgnoreCase)) { return Regex.Replace(text2, "^automatic pickup", "Auto pickup", RegexOptions.IgnoreCase); } return text; } if (Regex.IsMatch(text2, "^you (?:have )?(?:picked up|obtained|received) ", RegexOptions.IgnoreCase)) { return Regex.Replace(text2, "^you (?:have )?(?:picked up|obtained|received) ", "", RegexOptions.IgnoreCase); } if (Regex.IsMatch(text2, "^you (?:have )?(?:discovered|unlocked) ", RegexOptions.IgnoreCase)) { return Regex.Replace(text2, "^you (?:have )?(?:discovered|unlocked) ", "Unlocked ", RegexOptions.IgnoreCase); } if (Regex.IsMatch(text2, "^you (?:have )?(?:successfully )?(?:saved|restored|repaired) ", RegexOptions.IgnoreCase)) { return Regex.Replace(text2, "^you (?:have )?(?:successfully )?", "", RegexOptions.IgnoreCase); } if (Regex.IsMatch(text2, "^automatic pickup\\s*:\\s*", RegexOptions.IgnoreCase)) { return Regex.Replace(text2, "^automatic pickup", "Auto pickup", RegexOptions.IgnoreCase); } return text; } internal static string SimplifyStatusSentence(string original) { if (string.IsNullOrWhiteSpace(original)) { return original; } string text = original.Trim(); int num = text.Length; char c = text[num - 1]; if (c == '.' || c == '!') { num--; } int num2; if (text.StartsWith("You are ", StringComparison.OrdinalIgnoreCase)) { num2 = 8; } else { if (!text.StartsWith("You feel ", StringComparison.OrdinalIgnoreCase)) { return original; } num2 = 9; } if (num <= num2) { return original; } string text2 = text.Substring(num2, num - num2); if (text2.StartsWith("now ", StringComparison.OrdinalIgnoreCase)) { text2 = text2.Substring(4); } if (string.Equals(text2, "warmer", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "warming up", StringComparison.OrdinalIgnoreCase)) { return "Warming up"; } if (string.Equals(text2, "dry", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "no longer wet", StringComparison.OrdinalIgnoreCase)) { return "Dry"; } if (string.Equals(text2, "on fire", StringComparison.OrdinalIgnoreCase) && text.StartsWith("You are ", StringComparison.OrdinalIgnoreCase) && !text.StartsWith("You are now ", StringComparison.OrdinalIgnoreCase)) { return "Burning"; } for (int i = 0; i < SimpleStatusLabels.Length; i++) { if (string.Equals(text2, SimpleStatusLabels[i], StringComparison.OrdinalIgnoreCase)) { return SimpleStatusLabels[i]; } } return original; } private static string SkillLevelText(Kind kind, string original, string localized, bool compact, string fortifiedBlue) { string text = localized ?? ""; Match match = LevelAtEnd.Match(text); if (!match.Success) { match = LevelAtEnd.Match(original ?? ""); } if (!match.Success) { return text; } string text2 = ((kind == Kind.FortifiedLevel) ? fortifiedBlue : "#E7C745"); string text3 = "<color=" + text2 + ">" + match.Groups[1].Value + "</color>"; if (compact) { return "LVL. " + text3; } Match match2 = LevelAtEnd.Match(text); if (!match2.Success) { return text + " LVL. " + text3; } return text.Substring(0, match2.Groups[1].Index) + text3 + text.Substring(match2.Groups[1].Index + match2.Groups[1].Length); } } internal static class CompactLocalization { internal static bool IsEnglish { get { Localization instance = Localization.instance; if (instance != null) { return string.Equals(instance.GetSelectedLanguage(), "English", StringComparison.OrdinalIgnoreCase); } return true; } } internal static string NativeToken(string token, string fallback) { Localization instance = Localization.instance; if (instance == null || string.IsNullOrWhiteSpace(token)) { return fallback; } string text = instance.Localize(token); if (string.IsNullOrWhiteSpace(text) || string.Equals(text, token, StringComparison.Ordinal) || text.IndexOf('$') >= 0) { return fallback; } return text.Trim(); } } internal static class CompactV11 { private sealed class Rule { internal readonly Regex Pattern; internal readonly string Replacement; internal readonly char Initial; internal Rule(string pattern, string replacement) { Pattern = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); Replacement = replacement; Initial = ((pattern.Length > 1 && pattern[0] == '^' && char.IsLetter(pattern[1])) ? char.ToUpperInvariant(pattern[1]) : '\0'); } } private static readonly Rule[] Rules = new Rule[60] { new Rule("^(?:This |The )?crafting station needs a roof[.!]?$", "Requires roof"), new Rule("^(?:This |The )?crafting station (?:is )?too exposed[.!]?$", "Requires shelter"), new Rule("^(?:This |The )?station (?:is )?too exposed[.!]?$", "Requires shelter"), new Rule("^(?:This |The )?(?:crafting )?station requires (?:a )?roof[.!]?$", "Requires roof"), new Rule("^(?:You need (?:a )?roof|Roof required|Requires a roof)[.!]?$", "Requires roof"), new Rule("^(?:You need to be sheltered|Shelter required|Not enough shelter)[.!]?$", "Requires shelter"), new Rule("^(?:You need a fire nearby|A nearby fire is required)[.!]?$", "Requires nearby fire"), new Rule("^(?:You need a crafting station|Crafting station required)[.!]?$", "Requires station"), new Rule("^Nothing to (?:quick )?stack[.!]?$", "Nothing to stack"), new Rule("^Stacked 0 items?[.!]?$", "Nothing stacked"), new Rule("^Stacked (\\d+) items?[.!]?$", "Stacked $1"), new Rule("^Nothing to restock[.!]?$", "Nothing to restock"), new Rule("^Couldn.t restock\\s*\\((\\d+)\\s*/\\s*(\\d+)\\)[.!]?$", "Restock failed ($1/$2)"), new Rule("^Partially restocked\\s*\\((\\d+)\\s*/\\s*(\\d+)\\)[.!]?$", "Restocked ($1/$2)"), new Rule("^Fully restocked\\s*\\(total:\\s*(\\d+)\\)[.!]?$", "Restocked ($1)"), new Rule("^Can.t trash favorited item[.!]?$", "Favorited item protected"), new Rule("^Can.t trash flag a favorited item[.!]?$", "Favorited item: can't trash-flag"), new Rule("^Settings disallow trashing of item in hotkey bar[.!]?$", "Hotbar item protected"), new Rule("^Can.t favorite a trash flagged item[.!]?$", "Trash-flagged item: can't favorite"), new Rule("^(?:You (?:have |do )?not have|You need) enough (stamina|eitr|health)[.!]?$", "Not enough $1"), new Rule("^You (?:don.t|do not) have enough (stamina|eitr|health)[.!]?$", "Not enough $1"), new Rule("^You are (?:now )?(?:over[- ]encumbered|encumbered|overburdened|overloaded)[.!]?$", "Overburdened"), new Rule("^You (?:can.t|cannot) carry any more[.!]?$", "Overburdened"), new Rule("^You need more free inventory space[.!]?$", "Need inventory space"), new Rule("^(?:There is |You have )no (?:more )?(?:room|space) in your inventory[.!]?$", "Inventory full"), new Rule("^You (?:are )?(?:too far away|out of range)(?: to interact)?[.!]?$", "Too far away"), new Rule("^You (?:are |were )?unable to equip (.+)[.!]?$", "Can't equip $1"), new Rule("^You need (?:to have )?a (.+) nearby[.!]?$", "Need nearby $1"), new Rule("^You need (?:a |an )?(.+) to (?:craft|build|repair) (.+)[.!]?$", "Need $1 for $2"), new Rule("^(?:World (?:is )?saving|Saving (?:the )?world)(?:\\.{0,3})$", "Saving world"), new Rule("^(?:World (?:has been )?saved|Saved (?:the )?world|World save completed|Save completed)\\s*(?:in\\s*|\\(\\s*)?(\\d+(?:[.,]\\d+)?)\\s*(ms|milliseconds?|s|sec|seconds?)\\)?[.!]?$", "World saved ($1$2)"), new Rule("^(?:World (?:has been )?saved|World save completed|Save completed)[.!]?$", "World saved"), new Rule("^(?:Your )?spawn point (?:is now )?(?:set|updated)[.!]?$", "Spawn point set"), new Rule("^You (?:have )?(?:recovered|retrieved) (?:your )?items[.!]?$", "Items recovered"), new Rule("^Your (items|equipment) (?:have been |were )?recovered[.!]?$", "$1 recovered"), new Rule("^You (?:are )?(?:now )?being hunted[.!]?$", "Hunted"), new Rule("^You are (?:no longer|not) sheltered[.!]?$", "Exposed"), new Rule("^You (?:have )?(?:connected|linked) (?:the )?portal[.!]?$", "Portal connected"), new Rule("^(?:Portal|The portal) (?:is )?(?:not connected|unconnected)[.!]?$", "Portal unconnected"), new Rule("^(?:Your )?portal destination (?:is )?missing[.!]?$", "No portal destination"), new Rule("^You (?:have )?(?:successfully )?(?:crafted|created) (.+)[.!]?$", "Crafted $1"), new Rule("^You (?:have )?(?:successfully )?upgraded (.+)[.!]?$", "Upgraded $1"), new Rule("^You (?:have )?(?:successfully )?repaired (.+)[.!]?$", "Repaired $1"), new Rule("^You (?:have )?learned (?:how to make |the recipe for )(.+)[.!]?$", "Recipe: $1"), new Rule("^New recipe (?:unlocked|discovered):?\\s*(.+)[.!]?$", "Recipe: $1"), new Rule("^New (?:quest|mission):?\\s*(.+)[.!]?$", "Quest: $1"), new Rule("^(?:Quest|Bounty) (?:has been )?completed:?\\s*(.+)[.!]?$", "Completed: $1"), new Rule("^(?:You have )?completed (?:the )?(quest|bounty):?\\s*(.+)[.!]?$", "$1 complete: $2"), new Rule("^You (?:have )?(?:successfully )?enchanted (.+)[.!]?$", "Enchanted $1"), new Rule("^You (?:have )?(?:successfully )?augmented (.+)[.!]?$", "Augmented $1"), new Rule("^You (?:have )?(?:successfully )?disenchanted (.+)[.!]?$", "Disenchanted $1"), new Rule("^You (?:have )?(?:successfully )?sold (.+)[.!]?$", "Sold $1"), new Rule("^You (?:have )?(?:successfully )?purchased (.+)[.!]?$", "Bought $1"), new Rule("^You (?:have )?(?:successfully )?bought (.+)[.!]?$", "Bought $1"), new Rule("^(?:Your )?(?:companion|pet) (.+) (?:has )?leveled up(?: to level (\\d+))?[.!]?$", "$1 level $2"), new Rule("^You (?:have )?caught (?:a |an )?(.+)[.!]?$", "Caught $1"), new Rule("^You (?:have )?hooked (?:a |an )?(.+)[.!]?$", "Hooked $1"), new Rule("^(?:Your )?fishing line (?:has )?(?:snapped|broken)[.!]?$", "Line snapped"), new Rule("^You (?:have )?run out of (.+ bait)[.!]?$", "Out of $1"), new Rule("^You (?:have )?(?:collected|harvested|gathered) (.+)[.!]?$", "Gathered $1") }; internal static bool TryFormat(string original, out string compact) { compact = null; if (string.IsNullOrWhiteSpace(original)) { return false; } string text = original.Trim(); if (text.Length > 512 || text.IndexOf('<') >= 0 || text.IndexOf('\n') >= 0 || text.IndexOf('\r') >= 0) { return false; } char c = char.ToUpperInvariant(text[0]); for (int i = 0; i < Rules.Length; i++) { Rule rule = Rules[i]; if (rule.Initial != 0 && rule.Initial != c) { continue; } Match match = rule.Pattern.Match(text); if (match.Success) { compact = match.Result(Rules[i].Replacement); if (compact.EndsWith("level ", StringComparison.Ordinal)) { compact = compact.Substring(0, compact.Length - 6); } return !string.Equals(compact, text, StringComparison.Ordinal); } } return false; } } internal static class ContextIconCapture { [HarmonyPatch(typeof(CraftingStation), "CheckUsable")] private static class StationUse { [HarmonyPrefix] private static void Prefix(CraftingStation __instance, out Sprite __state) { __state = _stationIcon; Sprite val = (((Object)(object)__instance != (Object)null) ? __instance.m_icon : null); if ((Object)(object)val == (Object)null && (Object)(object)__instance != (Object)null) { Piece component = ((Component)__instance).GetComponent<Piece>(); if ((Object)(object)component != (Object)null) { val = component.m_icon; } } _stationIcon = val; } [HarmonyFinalizer] private static Exception Finalizer(Exception __exception, Sprite __state) { _stationIcon = __state; return __exception; } } [HarmonyPatch(typeof(FishingFloat), "Catch")] private static class FishingCatch { [HarmonyPrefix] private static void Prefix(Fish fish, Character owner, out Sprite __state) { __state = null; if (!((Object)(object)fish == (Object)null) && !((Object)(object)owner != (Object)(object)Player.m_localPlayer)) { ItemDrop component = ((Component)fish).GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null && (Object)(object)fish.m_pickupItem != (Object)null) { component = fish.m_pickupItem.GetComponent<ItemDrop>(); } if ((Object)(object)component != (Object)null && component.m_itemData != null) { __state = component.m_itemData.GetIcon(); } } } [HarmonyPostfix] private static void Postfix(Sprite __state, string __result) { if (!((Object)(object)__state == (Object)null) && !string.IsNullOrEmpty(__result)) { _fishIcon = __state; _fishRaw = __result; _fishLocalized = ((Localization.instance != null) ? Localization.instance.Localize(__result) : __result); _fishCapturedAt = Time.unscaledTime; } } } [ThreadStatic] private static Sprite _stationIcon; private static Sprite _fishIcon; private static string _fishRaw; private static string _fishLocalized; private static float _fishCapturedAt; internal static Sprite CurrentStationIcon => _stationIcon; internal static bool TryTakeFishIcon(string raw, string localized, out Sprite sprite) { sprite = null; if ((Object)(object)_fishIcon == (Object)null || Time.unscaledTime - _fishCapturedAt > 3f) { return false; } if (!string.Equals(raw, _fishRaw, StringComparison.Ordinal) && !string.Equals(raw, _fishLocalized, StringComparison.Ordinal) && !string.Equals(localized, _fishLocalized, StringComparison.Ordinal)) { return false; } sprite = _fishIcon; _fishIcon = null; _fishRaw = null; _fishLocalized = null; return true; } } internal static class ContextIcons { internal static Sprite Choose(string raw, string localized, string compact, Sprite provided) { if ((Object)(object)provided != (Object)null) { return provided; } string text = raw ?? ""; string text2 = compact ?? localized ?? ""; switch (text) { default: if (!string.Equals(text2, "Requires roof", StringComparison.OrdinalIgnoreCase) && !string.Equals(text2, "Requires shelter", StringComparison.OrdinalIgnoreCase) && !string.Equals(text2, "Requires nearby fire", StringComparison.OrdinalIgnoreCase)) { if (ContextIconCapture.TryTakeFishIcon(text, localized, out var sprite)) { return sprite; } if (text.IndexOf("$se_rested_start", StringComparison.Ordinal) >= 0 || text.IndexOf("$se_resting", StringComparison.Ordinal) >= 0 || text2.StartsWith("Rested", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "Resting", StringComparison.OrdinalIgnoreCase)) { return RestingIcon(); } return null; } goto case "$msg_stationneedroof"; case "$msg_stationneedroof": case "$msg_stationtooexposed": case "$msg_needfire": return ContextIconCapture.CurrentStationIcon; } } private static Sprite RestingIcon() { ObjectDB instance = ObjectDB.instance; if ((Object)(object)instance == (Object)null) { return null; } StatusEffect statusEffect = instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("Resting")); if ((Object)(object)statusEffect == (Object)null) { statusEffect = instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("Rested")); } if (!((Object)(object)statusEffect != (Object)null)) { return null; } return statusEffect.m_icon; } } internal static class NotificationSystem { private sealed class Notice { internal string Text; internal string Original; internal string CompactOverride; internal CompactFormat.Kind Kind; internal Sprite Icon; internal string UnlockCategory; internal List<Sprite> UnlockIcons; internal int UnlockIconIndex; internal float NextUnlockIconTime; internal int Amount; internal bool IsXp; internal bool IsCenter; internal bool ForceCenterColor; internal bool IsRepair; internal bool NeverMerge; internal bool IsFoodStats; internal float FoodHealth; internal float FoodStamina; internal float FoodEitr; internal SkillType SkillType; internal float XpAmount; internal float CurrentXp; internal float RequiredXp; internal bool HasXpProgress; internal int Revision; } private sealed class EntryView { internal GameObject Root; internal Image Icon; internal LayoutElement IconLayout; internal LayoutElement TextLayout; internal TMP_Text Text; internal string LastMeasuredText; internal float LastMeasuredIconSize = -1f; internal Notice RenderedNotice; internal int RenderedRevision = -1; internal int RenderedAppearanceRevision = -1; internal bool IsAlive { get { if ((Object)(object)Root != (Object)null && (Object)(object)Icon != (Object)null && (Object)(object)IconLayout != (Object)null) { return (Object)(object)Text != (Object)null; } return false; } } } private const float FadeDuration = 1f; private static readonly Regex FoodHealthRegex = new Regex("\\+([0-9]+(?:[\\.,][0-9]+)?)\\s+\\$item_food_health", RegexOptions.Compiled); private static readonly Regex FoodStaminaRegex = new Regex("\\+([0-9]+(?:[\\.,][0-9]+)?)\\s+\\$item_food_stamina", RegexOptions.Compiled); private static readonly Regex FoodEitrRegex = new Regex("\\+([0-9]+(?:[\\.,][0-9]+)?)\\s+\\$item_food_eitr", RegexOptions.Compiled); private static readonly LinkedList<Notice> ActiveNotifications = new LinkedList<Notice>(); private static readonly List<EntryView> Entries = new List<EntryView>(); private static MessageHud _hud; private static GameObject _panel; private static CanvasGroup _panelGroup; private static Canvas _panelCanvas; private static bool _inventoryWasVisible; private static RectTransform _azuQuickbarRect; private static float _timer; private static int _appearanceRevision; private static float _nextCrosshairSampleTime; private static Vector2 _cachedCrosshairPosition = new Vector2(-85f, 10f); private static float _nextEdgePaddingSampleTime; private static Vector2 _cachedBottomRightPadding = new Vector2(36f, 36f); private static string _selectedBlue; private static float _nextSelectionColorLookup; private const string FallbackSelectionBlue = "#79B9F0"; private static bool IsRightAligned() { return WiresNotificationOverhaulPlugin.NotificationAlignment.Value == WiresNotificationOverhaulPlugin.TextAlignment.Right; } internal static bool TryHandleMessage(MessageHud hud, MessageType type, string text, int amount, Sprite icon, bool showDespiteHiddenHud, bool isRepair = false, string contextCompact = null, bool neverMerge = false) { //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 bool num = (int)type == 1; bool flag = (int)type == 2; if (!num && !flag) { return false; } if (flag && WiresNotificationOverhaulPlugin.MoveCenterNotifications.Value != WiresNotificationOverhaulPlugin.Toggle.On) { return false; } if (Hud.IsUserHidden() && !showDespiteHiddenHud) { return true; } if (WiresNotificationOverhaulPlugin.PickupNotificationsOnly.Value == WiresNotificationOverhaulPlugin.Toggle.On && (string.IsNullOrWhiteSpace(text) || (Object)(object)icon == (Object)null || amount < 1)) { return false; } if (!EnsurePanel(hud)) { return false; } if (flag && TryParseFoodStats(text, out var health, out var stamina, out var eitr)) { Notice notice = FindFoodStats(); if (notice == null) { if (ActiveNotifications.Count >= WiresNotificationOverhaulPlugin.MaxVisibleNotifications.Value) { ActiveNotifications.RemoveFirst(); } notice = new Notice { IsCenter = true, ForceCenterColor = true, IsFoodStats = true }; ActiveNotifications.AddLast(notice); } notice.FoodHealth += health; notice.FoodStamina += stamina; notice.FoodEitr += eitr; notice.Revision++; _timer = 0f; if ((Object)(object)_panelGroup != (Object)null) { _panelGroup.alpha = 1f; } return true; } string text2 = ((Localization.instance != null) ? Localization.instance.Localize(text) : text); CompactFormat.Kind kind = CompactFormat.Detect(text, text2); if (UnlockCapture.Enabled && kind == CompactFormat.Kind.NewUnlocks) { return true; } if (kind == CompactFormat.Kind.FortifiedLevel) { List<string> log = hud.GetLog(); if (log != null) { log.Add(CompactFormat.Text(CompactFormat.Kind.FortifiedLevel, text, text2, amount, compact: false, SelectionBlue())); while (log.Count > hud.m_maxLogMessages) { log.RemoveAt(0); } } } Notice notice2 = (neverMerge ? null : FindExisting(text2, flag)); if (notice2 != null) { notice2.Amount += amount; notice2.Revision++; } else { if (ActiveNotifications.Count >= WiresNotificationOverhaulPlugin.MaxVisibleNotifications.Value) { ActiveNotifications.RemoveFirst(); } string compactText = null; Sprite icon2 = null; if (contextCompact != null) { compactText = (CompactLocalization.IsEnglish ? contextCompact : text2); } else if (isRepair) { compactText = (CompactLocalization.IsEnglish ? "Repaired" : text2); } else if (kind == CompactFormat.Kind.Other) { StatusMessageFormatter.TryResolve(text, text2, out compactText, out icon2); if ((Object)(object)icon == (Object)null && string.Equals(compactText, "Dry", StringComparison.OrdinalIgnoreCase)) { icon2 = null; } } ActiveNotifications.AddLast(new Notice { Text = text2, Original = text, CompactOverride = compactText, IsRepair = isRepair, NeverMerge = neverMerge, Kind = kind, Icon = ContextIcons.Choose(text, text2, compactText ?? text2, ((Object)(object)icon != (Object)null) ? icon : icon2), Amount = amount, IsCenter = flag }); } _timer = 0f; if ((Object)(object)_panelGroup != (Object)null) { _panelGroup.alpha = 1f; } return true; } internal static bool TryShowGroupedUnlock(MessageHud hud, string category, Sprite icon) { if ((Object)(object)hud == (Object)null || Hud.IsUserHidden() || !EnsurePanel(hud)) { return false; } if (string.IsNullOrWhiteSpace(category)) { category = CompactLocalization.NativeToken("$inventory_logs_new", "Discoveries"); } Notice notice = null; for (LinkedListNode<Notice> linkedListNode = ActiveNotifications.First; linkedListNode != null; linkedListNode = linkedListNode.Next) { if (linkedListNode.Value.UnlockCategory == category) { notice = linkedListNode.Value; break; } } if (notice == null) { if (ActiveNotifications.Count >= WiresNotificationOverhaulPlugin.MaxVisibleNotifications.Value) { ActiveNotifications.RemoveFirst(); } notice = new Notice { UnlockCategory = category, UnlockIcons = new List<Sprite>(), Amount = 0, Text = "", Original = "" }; ActiveNotifications.AddLast(notice); } notice.Amount++; string text = ((!CompactLocalization.IsEnglish) ? CompactLocalization.NativeToken("$inventory_logs_new", category) : ((notice.Amount == 1) ? "new unlock" : "new unlocks")); notice.Text = notice.Amount + " " + text + " (" + category + ")"; notice.Original = notice.Text; if ((Object)(object)icon != (Object)null) { notice.UnlockIcons.Add(icon); if (notice.UnlockIcons.Count == 1) { notice.Icon = icon; } if (notice.UnlockIcons.Count == 2) { notice.NextUnlockIconTime = Time.unscaledTime + 0.5f; } } notice.Revision++; _timer = 0f; if ((Object)(object)_panelGroup != (Object)null) { _panelGroup.alpha = 1f; } return true; } internal static void ShowPotionEffectEnded(string itemNameToken, Sprite icon, bool available) { if ((Object)(object)MessageHud.instance == (Object)null || Hud.IsUserHidden()) { return; } string text = ((Localization.instance != null) ? Localization.instance.Localize(itemNameToken) : itemNameToken); string text2 = (CompactLocalization.IsEnglish ? ((!string.IsNullOrWhiteSpace(text)) ? (text + (available ? " available" : " expired")) : (available ? "Potion available" : "Potion expired")) : ((available ? "+ " : "- ") + text)); if (WiresNotificationOverhaulPlugin.MoveCenterNotifications.Value != WiresNotificationOverhaulPlugin.Toggle.On) { MessageHud.instance.ShowMessage((MessageType)2, text2, 0, icon, false, true); } else if (EnsurePanel(MessageHud.instance)) { if (ActiveNotifications.Count >= WiresNotificationOverhaulPlugin.MaxVisibleNotifications.Value) { ActiveNotifications.RemoveFirst(); } ActiveNotifications.AddLast(new Notice { Text = text2, Original = text2, Kind = (available ? CompactFormat.Kind.PotionAvailable : CompactFormat.Kind.PotionExpired), Icon = icon, Amount = 0, IsCenter = true, ForceCenterColor = true }); _timer = 0f; if ((Object)(object)_panelGroup != (Object)null) { _panelGroup.alpha = 1f; } } } private static string Percent(float current, float required) { decimal d = (decimal)current * 100m / (decimal)required; d = Math.Round(d, 1, MidpointRounding.AwayFromZero); if (d > 100m) { d = 100m; } if (d < 0m) { d = default(decimal); } return d.ToString("0.0", CultureInfo.CurrentCulture) + "%"; } internal static void ShowSkillXp(SkillDef skill, float amount, float currentXp, float requiredXp, bool hasXpProgress) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) if (skill == null || amount <= 0f || (Object)(object)MessageHud.instance == (Object)null || Hud.IsUserHidden() || !EnsurePanel(MessageHud.instance)) { return; } Notice notice = FindExistingXp(skill.m_skill); if (notice != null) { notice.XpAmount += amount; notice.CurrentXp = currentXp; notice.RequiredXp = requiredXp; notice.HasXpProgress = hasXpProgress; notice.Revision++; } else { if (ActiveNotifications.Count >= WiresNotificationOverhaulPlugin.MaxVisibleNotifications.Value) { ActiveNotifications.RemoveFirst(); } string text = "$skill_" + ((object)Unsafe.As<SkillType, SkillType>(ref skill.m_skill)/*cast due to .constrained prefix*/).ToString().ToLowerInvariant(); string text2 = ((Localization.instance != null) ? Localization.instance.Localize(text) : ((object)Unsafe.As<SkillType, SkillType>(ref skill.m_skill)/*cast due to .constrained prefix*/).ToString()); ActiveNotifications.AddLast(new Notice { Text = text2, Icon = skill.m_icon, Amount = 0, IsXp = true, SkillType = skill.m_skill, XpAmount = amount, CurrentXp = currentXp, RequiredXp = requiredXp, HasXpProgress = hasXpProgress }); } _timer = 0f; if ((Object)(object)_panelGroup != (Object)null) { _panelGroup.alpha = 1f; } } internal static void Tick(MessageHud hud, float dt) { WiresNotificationOverhaulPlugin.CompleteLegacyPresetMigrationWhenReady(); if (ActiveNotifications.Count == 0) { HidePanel(); } else if (EnsurePanel(hud)) { bool flag = InventoryGui.IsVisible(); if (flag != _inventoryWasVisible) { _inventoryWasVisible = flag; KeepBehindInventoryPanels(); } _timer += dt; UpdatePanelPosition(); RefreshEntries(hud); float value = WiresNotificationOverhaulPlugin.NotificationDuration.Value; float num = value - 1f; float num2 = ((_timer < num) ? 1f : ((!(_timer >= value)) ? Mathf.Lerp(1f, 0f, Mathf.InverseLerp(num, value, _timer)) : 0f)); if ((Object)(object)_panelGroup != (Object)null) { _panelGroup.alpha = Mathf.MoveTowards(_panelGroup.alpha, num2, dt / 1f); } if (_timer >= value) { ClearNotifications(); } } } private static Notice FindExisting(string localizedText, bool isCenter) { for (LinkedListNode<Notice> linkedListNode = ActiveNotifications.First; linkedListNode != null; linkedListNode = linkedListNode.Next) { if (!linkedListNode.Value.IsXp && !linkedListNode.Value.IsFoodStats && !linkedListNode.Value.NeverMerge && linkedListNode.Value.UnlockCategory == null && linkedListNode.Value.IsCenter == isCenter && linkedListNode.Value.Text == localizedText) { return linkedListNode.Value; } } return null; } private static Notice FindFoodStats() { for (LinkedListNode<Notice> linkedListNode = ActiveNotifications.First; linkedListNode != null; linkedListNode = linkedListNode.Next) { if (linkedListNode.Value.IsFoodStats) { return linkedListNode.Value; } } return null; } private static bool TryParseFoodStats(string text, out float health, out float stamina, out float eitr) { health = 0f; stamina = 0f; eitr = 0f; if (string.IsNullOrWhiteSpace(text) || text.IndexOf("$item_food_", StringComparison.Ordinal) < 0) { return false; } return (byte)(0u | (TryParseFoodValue(FoodHealthRegex, text, out health) ? 1u : 0u) | (TryParseFoodValue(FoodStaminaRegex, text, out stamina) ? 1u : 0u) | (TryParseFoodValue(FoodEitrRegex, text, out eitr) ? 1u : 0u)) != 0; } private static bool TryParseFoodValue(Regex regex, string text, out float value) { value = 0f; Match match = regex.Match(text); if (!match.Success || match.Groups.Count < 2) { return false; } string value2 = match.Groups[1].Value; if (!float.TryParse(value2, NumberStyles.Float, CultureInfo.CurrentCulture, out value)) { return float.TryParse(value2.Replace(',', '.'), NumberStyles.Float, CultureInfo.InvariantCulture, out value); } return true; } private static Notice FindExistingXp(SkillType skillType) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) for (LinkedListNode<Notice> linkedListNode = ActiveNotifications.First; linkedListNode != null; linkedListNode = linkedListNode.Next) { if (linkedListNode.Value.IsXp && linkedListNode.Value.SkillType == skillType) { return linkedListNode.Value; } } return null; } private static bool EnsurePanel(MessageHud hud) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown if ((Object)(object)hud == (Object)null || (Object)(object)hud.m_messageText == (Object)null) { return false; } if ((Object)(object)_hud != (Object)(object)hud) { ResetForHud(hud); } if ((Object)(object)_panel != (Object)null && (Object)(object)_panelGroup != (Object)null) { return true; } Entries.Clear(); _panel = new GameObject("WireNotificationPanel", new Type[2] { typeof(RectTransform), typeof(CanvasGroup) }); _panel.transform.SetParent(((Component)hud).transform, false); _panelCanvas = _panel.AddComponent<Canvas>(); _panelCanvas.overrideSorting = true; _panelGroup = _panel.GetComponent<CanvasGroup>(); _panelGroup.blocksRaycasts = false; _panelGroup.interactable = false; _inventoryWasVisible = InventoryGui.IsVisible(); KeepBehindInventoryPanels(); RectTransform component = _panel.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(0f, 1f); component.pivot = new Vector2(0f, 1f); component.sizeDelta = new Vector2(400f, 32f); VerticalLayoutGroup obj = _panel.AddComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 4f; ((LayoutGroup)obj).padding = new RectOffset(0, 0, 0, 0); ((LayoutGroup)obj).childAlignment = (TextAnchor)0; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = false; _panelGroup.alpha = 0f; UpdatePanelPosition(); return true; } private static void KeepBehindInventoryPanels() { if (!((Object)(object)_panelCanvas == (Object)null)) { Canvas val = null; InventoryGui instance = InventoryGui.instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.m_inventoryRoot != (Object)null) { val = ((Component)instance.m_inventoryRoot).GetComponentInParent<Canvas>(); } Canvas val2 = null; if ((Object)(object)((Component)_panelCanvas).transform.parent != (Object)null) { val2 = ((Component)((Component)_panelCanvas).transform.parent).GetComponentInParent<Canvas>(); } Canvas val3 = (((Object)(object)val != (Object)null) ? val : val2); int num = (((Object)(object)val3 != (Object)null) ? (val3.sortingOrder - 1) : (-1)); if (_panelCanvas.sortingOrder != num) { _panelCanvas.sortingOrder = num; } } } private static void ResetForHud(MessageHud hud) { //IL_004f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_panel != (Object)null) { Object.Destroy((Object)(object)_panel); } _hud = hud; _panel = null; _panelGroup = null; _panelCanvas = null; _inventoryWasVisible = false; _azuQuickbarRect = null; _nextCrosshairSampleTime = 0f; _cachedCrosshairPosition = new Vector2(-85f, 10f); _nextEdgePaddingSampleTime = 0f; _cachedBottomRightPadding = new Vector2(36f, 36f); Entries.Clear(); ActiveNotifications.Clear(); _timer = 0f; } private static EntryView CreateEntry(MessageHud hud) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_00b4: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("WireNotificationEntry", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(_panel.transform, false); val.GetComponent<RectTransform>().sizeDelta = new Vector2(400f, 32f); HorizontalLayoutGroup obj = val.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 8f; ((LayoutGroup)obj).padding = new RectOffset(0, 0, 0, 0); ((LayoutGroup)obj).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = false; GameObject val2 = new GameObject("Icon", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); val2.transform.SetParent(val.transform, false); val2.GetComponent<RectTransform>().sizeDelta = new Vector2(28f, 28f); Image component = val2.GetComponent<Image>(); LayoutElement iconLayout = val2.AddComponent<LayoutElement>(); GameObject val3 = Object.Instantiate<GameObject>(((Component)hud.m_messageText).gameObject, val.transform, false); ((Object)val3).name = "Text"; RectTransform component2 = val3.GetComponent<RectTransform>(); if ((Object)(object)component2 != (Object)null) { component2.anchorMin = Vector2.zero; } TMP_Text component3 = val3.GetComponent<TMP_Text>(); LayoutElement val4 = val3.GetComponent<LayoutElement>() ?? val3.AddComponent<LayoutElement>(); val4.minWidth = 0f; val4.preferredWidth = 360f; val4.flexibleWidth = 0f; val4.preferredHeight = 32f; val4.flexibleHeight = 0f; EntryView obj2 = new EntryView { Root = val, Icon = component, IconLayout = iconLayout, TextLayout = val4, Text = component3 }; ApplyIconLayout(obj2); return obj2; } private static void RefreshEntries(MessageHud hud) { //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) for (int num = Entries.Count - 1; num >= 0; num--) { if (!Entries[num].IsAlive) { Entries.RemoveAt(num); } } int num2 = 0; bool flag = WiresNotificationOverhaulPlugin.Placement.Value == WiresNotificationOverhaulPlugin.PositionPreset.BottomRight; for (LinkedListNode<Notice> linkedListNode = (flag ? ActiveNotifications.Last : ActiveNotifications.First); linkedListNode != null; linkedListNode = (flag ? linkedListNode.Previous : linkedListNode.Next)) { EntryView entryView; if (num2 < Entries.Count) { entryView = Entries[num2]; } else { entryView = CreateEntry(hud); Entries.Add(entryView); } Notice value = linkedListNode.Value; if (value.UnlockIcons != null && value.UnlockIcons.Count > 1 && Time.unscaledTime >= value.NextUnlockIconTime) { value.UnlockIconIndex = (value.UnlockIconIndex + 1) % value.UnlockIcons.Count; value.Icon = value.UnlockIcons[value.UnlockIconIndex]; value.NextUnlockIconTime = Time.unscaledTime + 0.5f; if (entryView.RenderedNotice == value && (Object)(object)entryView.Icon != (Object)null) { entryView.Icon.sprite = value.Icon; } } if (entryView.RenderedNotice != value || entryView.RenderedRevision != value.Revision || entryView.RenderedAppearanceRevision != _appearanceRevision) { UpdateEntry(entryView, value); entryView.RenderedNotice = value; entryView.RenderedRevision = value.Revision; entryView.RenderedAppearanceRevision = _appearanceRevision; } if (!entryView.Root.activeSelf) { entryView.Root.SetActive(true); } num2++; } for (int i = num2; i < Entries.Count; i++) { if ((Object)(object)Entries[i].Root != (Object)null && Entries[i].Root.activeSelf) { Entries[i].Root.SetActive(false); } } if (!((Object)(object)_panel != (Object)null)) { return; } RectTransform component = _panel.GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { float num3 = Mathf.Max(32f, WiresNotificationOverhaulPlugin.IconSize.Value); float num4 = Mathf.Max(32f, (float)num2 * (num3 + 4f) - 4f); if (!Mathf.Approximately(component.sizeDelta.y, num4)) { component.sizeDelta = new Vector2(400f, num4); } } if (!_panel.activeSelf) { _panel.SetActive(true); } } private static void ApplyIconLayout(EntryView view) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if (view != null && view.IsAlive) { bool flag = IsRightAligned(); if (flag) { ((Component)view.Icon).transform.SetAsLastSibling(); } else { ((Component)view.Icon).transform.SetAsFirstSibling(); } HorizontalLayoutGroup component = view.Root.GetComponent<HorizontalLayoutGroup>(); if ((Object)(object)component != (Object)null) { ((LayoutGroup)component).childAlignment = (TextAnchor)(flag ? 5 : 3); } view.Text.alignment = (TextAlignmentOptions)(flag ? 516 : 513); float num = Mathf.Max(32f, WiresNotificationOverhaulPlugin.IconSize.Value); RectTransform component2 = view.Root.GetComponent<RectTransform>(); if ((Object)(object)component2 != (Object)null && !Mathf.Approximately(component2.sizeDelta.y, num)) { component2.sizeDelta = new Vector2(400f, num); } } } internal static void UpdateEntryLayout() { _appearanceRevision++; foreach (EntryView entry in Entries) { ApplyIconLayout(entry); entry.RenderedAppearanceRevision = -1; entry.LastMeasuredText = null; entry.LastMeasuredIconSize = -1f; } } private static void UpdateEntry(EntryView view, Notice notice) { //IL_0099: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) if (view == null || !view.IsAlive) { return; } bool flag = (Object)(object)notice.Icon != (Object)null; if (((Behaviour)view.Icon).enabled != flag) { ((Behaviour)view.Icon).enabled = flag; } if ((Object)(object)view.Icon.sprite != (Object)(object)notice.Icon) { view.Icon.sprite = notice.Icon; } view.Icon.preserveAspect = true; view.Icon.pixelsPerUnitMultiplier = 1f; float value = WiresNotificationOverhaulPlugin.IconSize.Value; RectTransform rectTransform = ((Graphic)view.Icon).rectTransform; if ((Object)(object)rectTransform != (Object)null && (!Mathf.Approximately(rectTransform.sizeDelta.x, value) || !Mathf.Approximately(rectTransform.sizeDelta.y, value))) { rectTransform.sizeDelta = new Vector2(value, value); } if (!Mathf.Approximately(view.IconLayout.preferredWidth, value)) { view.IconLayout.preferredWidth = value; } if (!Mathf.Approximately(view.IconLayout.preferredHeight, value)) { view.IconLayout.preferredHeight = value; } if (!Mathf.Approximately(view.IconLayout.minWidth, value)) { view.IconLayout.minWidth = value; } if (!Mathf.Approximately(view.IconLayout.minHeight, value)) { view.IconLayout.minHeight = value; } if (!Mathf.Approximately(view.IconLayout.flexibleWidth, 0f)) { view.IconLayout.flexibleWidth = 0f; } if (!Mathf.Approximately(view.IconLayout.flexibleHeight, 0f)) { view.IconLayout.flexibleHeight = 0f; } float num = Mathf.Max(220f, 400f - value - 12f); if ((Object)(object)view.TextLayout != (Object)null) { if (!Mathf.Approximately(view.TextLayout.preferredWidth, num)) { view.TextLayout.preferredWidth = num; } float num2 = Mathf.Max(32f, value); if (!Mathf.Approximately(view.TextLayout.preferredHeight, num2)) { view.TextLayout.preferredHeight = num2; } } float value2 = WiresNotificationOverhaulPlugin.NotificationsFontSize.Value; if (!Mathf.Approximately(view.Text.fontSize, value2)) { view.Text.fontSize = value2; } Color val = WiresNotificationOverhaulPlugin.NotificationTextColor.Value; if (notice.IsCenter && (notice.ForceCenterColor || WiresNotificationOverhaulPlugin.PreserveCenterMessageColor.Value == WiresNotificationOverhaulPlugin.Toggle.On) && (Object)(object)_hud != (Object)null && (Object)(object)_hud.m_messageCenterText != (Object)null) { val = ((Graphic)_hud.m_messageCenterText).color; } if (notice.IsRepair) { ((Color)(ref val))..ctor(77f / 85f, 0.78039217f, 23f / 85f, 1f); } if (((Graphic)view.Text).color != val) { ((Graphic)view.Text).color = val; } view.Text.textWrappingMode = (TextWrappingModes)0; view.Text.richText = true; bool flag2 = WiresNotificationOverhaulPlugin.CompactMode.Value == WiresNotificationOverhaulPlugin.Toggle.On; if (notice.UnlockCategory != null) { view.Text.text = notice.Text; } else if (notice.IsFoodStats) { string text = ""; if (notice.FoodHealth > 0f) { text = text + "<color=#D95056>+" + notice.FoodHealth.ToString("0.##", CultureInfo.CurrentCulture) + "</color>"; } if (notice.FoodStamina > 0f) { text = text + ((text.Length > 0) ? " " : "") + "<color=#E7C745>+" + notice.FoodStamina.ToString("0.##", CultureInfo.CurrentCulture) + "</color>"; } if (notice.FoodEitr > 0f) { text = text + ((text.Length > 0) ? " " : "") + "<color=#B879E2>+" + notice.FoodEitr.ToString("0.##", CultureInfo.CurrentCulture) + "</color>"; } view.Text.text = text; } else if (notice.IsXp) { bool flag3 = WiresNotificationOverhaulPlugin.XpProgressNotifications.Value == WiresNotificationOverhaulPlugin.Toggle.On && notice.HasXpProgress; string text2 = ((WiresNotificationOverhaulPlugin.XpProgressPercent.Value == WiresNotificationOverhaulPlugin.Toggle.On && notice.HasXpProgress && notice.RequiredXp > 0f) ? Percent(notice.CurrentXp, notice.RequiredXp) : (flag3 ? $"{notice.CurrentXp:0.##}/{notice.RequiredXp:0.##}xp" : $"+{notice.XpAmount:0.##}xp")); view.Text.text = (flag2 ? text2 : (notice.Text + " " + text2)); } else { view.Text.text = ((flag2 && !string.IsNullOrWhiteSpace(notice.CompactOverride)) ? notice.CompactOverride : CompactFormat.Text(notice.Kind, notice.Original, notice.Text, notice.Amount, flag2, (notice.Kind == CompactFormat.Kind.FortifiedLevel) ? SelectionBlue() : "#79B9F0")); } if (IsRightAligned()) { string text3 = view.Text.text; if (!string.Equals(view.LastMeasuredText, text3, StringComparison.Ordinal) || !Mathf.Approximately(view.LastMeasuredIconSize, value)) { view.LastMeasuredText = text3; view.LastMeasuredIconSize = value; float x = view.Text.GetPreferredValues(text3).x; if ((Object)(object)view.TextLayout != (Object)null) { view.TextLayout.preferredWidth = Mathf.Clamp(x + 4f, 24f, Mathf.Max(220f, 400f - value - 12f)); } } } else if (view.LastMeasuredText != null) { view.LastMeasuredText = null; view.LastMeasuredIconSize = -1f; if ((Object)(object)view.TextLayout != (Object)null) { view.TextLayout.preferredWidth = Mathf.Max(220f, 400f - value - 12f); } } } private static string SelectionBlue() { //IL_006e: 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_0075: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00ec: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0109: 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) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) if (_selectedBlue != null) { return _selectedBlue; } if (Time.unscaledTime < _nextSelectionColorLookup) { return "#79B9F0"; } _nextSelectionColorLookup = Time.unscaledTime + 8f; InventoryGui instance = InventoryGui.instance; if ((Object)(object)instance == (Object)null) { return "#79B9F0"; } _selectedBlue = "#79B9F0"; InventoryElement[] componentsInChildren = ((Component)instance).GetComponentsInChildren<InventoryElement>(true); foreach (InventoryElement val in componentsInChildren) { if ((Object)(object)val == (Object)null) { continue; } Color highlightOriginalColor = val.HighlightOriginalColor; if (highlightOriginalColor.b > highlightOriginalColor.r + 0.08f && highlightOriginalColor.b >= highlightOriginalColor.g && highlightOriginalColor.a > 0.25f) { _selectedBlue = "#" + ColorUtility.ToHtmlStringRGB(highlightOriginalColor); return _selectedBlue; } if (!((Object)(object)val.m_selected != (Object)null)) { continue; } Image component = val.m_selected.GetComponent<Image>(); if ((Object)(object)component != (Object)null) { highlightOriginalColor = ((Graphic)component).color; if (highlightOriginalColor.b > highlightOriginalColor.r + 0.08f && highlightOriginalColor.b >= highlightOriginalColor.g && highlightOriginalColor.a > 0.25f) { _selectedBlue = "#" + ColorUtility.ToHtmlStringRGB(highlightOriginalColor); return _selectedBlue; } } } return "#79B9F0"; } private static float GetAzuQuickbarOffset() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_azuQuickbarRect == (Object)null) { Hud instance = Hud.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.m_rootObject == (Object)null) { return 0f; } Transform val = instance.m_rootObject.transform.Find("AzuEPI_QuickAccessBar"); if ((Object)(object)val == (Object)null) { return 0f; } _azuQuickbarRect = ((Component)val).GetComponent<RectTransform>(); } if ((Object)(object)_azuQuickbarRect == (Object)null || !((Component)_azuQuickbarRect).gameObject.activeInHierarchy || ((Transform)_azuQuickbarRect).childCount == 0) { return 0f; } Bounds val2 = RectTransformUtility.CalculateRelativeRectTransformBounds((Transform)(object)_azuQuickbarRect); Rect rect = _azuQuickbarRect.rect; float num = Mathf.Max(((Rect)(ref rect)).height, ((Bounds)(ref val2)).size.y); return Mathf.Max(0f, num * Mathf.Abs(((Transform)_azuQuickbarRect).localScale.y) + 8f); } private static Vector2 NearCrosshairPosition(RectTransform parentRect) { //IL_0009: 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_004e: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_023d: 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_0247: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)parentRect == (Object)null) { return _cachedCrosshairPosition; } if (Time.unscaledTime < _nextCrosshairSampleTime) { return _cachedCrosshairPosition; } _nextCrosshairSampleTime = Time.unscaledTime + 0.4f; Hud instance = Hud.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.m_crosshair == (Object)null) { return _cachedCrosshairPosition; } RectTransform rectTransform = ((Graphic)instance.m_crosshair).rectTransform; RectTransform val = (((Object)(object)instance.m_staggerProgress != (Object)null) ? ((Component)instance.m_staggerProgress).GetComponent<RectTransform>() : null); if ((Object)(object)val == (Object)null && (Object)(object)instance.m_staggerAnimator != (Object)null) { val = ((Component)instance.m_staggerAnimator).GetComponent<RectTransform>(); } Bounds val2 = RectTransformUtility.CalculateRelativeRectTransformBounds((Transform)(object)parentRect, (Transform)(object)rectTransform); Rect rect = parentRect.rect; Vector2 center = ((Rect)(ref rect)).center; float num = 78f; float num2 = ((Bounds)(ref val2)).center.y - center.y; if ((Object)(object)val != (Object)null) { Bounds val3 = RectTransformUtility.CalculateRelativeRectTransformBounds((Transform)(object)parentRect, (Transform)(object)val); if ((((Bounds)(ref val3)).size.x < 4f || ((Bounds)(ref val3)).size.y < 2f) && (Object)(object)instance.m_staggerAnimator != (Object)null) { RectTransform component = ((Component)instance.m_staggerAnimator).GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { val3 = RectTransformUtility.CalculateRelativeRectTransformBounds((Transform)(object)parentRect, (Transform)(object)component); } } if (((Bounds)(ref val3)).size.x >= 4f && ((Bounds)(ref val3)).size.y >= 2f) { num2 = ((Bounds)(ref val3)).center.y - center.y; float num3 = -1f; if (((Bounds)(ref val3)).min.x >= ((Bounds)(ref val2)).max.x) { num3 = ((Bounds)(ref val3)).min.x - ((Bounds)(ref val2)).max.x; } else if (((Bounds)(ref val3)).max.x <= ((Bounds)(ref val2)).min.x) { num3 = ((Bounds)(ref val2)).min.x - ((Bounds)(ref val3)).max.x; } if (num3 >= 6f && num3 <= 420f) { num = num3; } } } float num4 = Mathf.Max(0f, WiresNotificationOverhaulPlugin.IconSize.Value); _cachedCrosshairPosition = new Vector2(((Bounds)(ref val2)).min.x - center.x - num - num4, num2); return _cachedCrosshairPosition; } private static Vector2 BottomRightPadding(RectTransform parentRect) { //IL_0009: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0062: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)parentRect == (Object)null) { return _cachedBottomRightPadding; } if (Time.unscaledTime < _nextEdgePaddingSampleTime) { return _cachedBottomRightPadding; } _nextEdgePaddingSampleTime = Time.unscaledTime + 0.4f; Hud instance = Hud.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.m_healthBarRoot == (Object)null) { return _cachedBottomRightPadding; } Bounds val = RectTransformUtility.CalculateRelativeRectTransformBounds((Transform)(object)parentRect, (Transform)(object)instance.m_healthBarRoot); Rect rect = parentRect.rect; float num = ((Bounds)(ref val)).min.x - ((Rect)(ref rect)).xMin; float num2 = ((Bounds)(ref val)).min.y - ((Rect)(ref rect)).yMin; if (num >= 12f && num <= 180f && num2 >= 12f && num2 <= 180f) { _cachedBottomRightPadding = new Vector2(num, num2); } return _cachedBottomRightPadding; } internal static Vector2 GetPresetCoordinates(WiresNotificationOverhaulPlugin.PositionPreset preset) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (preset == WiresNotificationOverhaulPlugin.PositionPreset.Default) { return new Vector2(40f, -160f); } MessageHud val = (((Object)(object)_hud != (Object)null) ? _hud : MessageHud.instance); RectTransform parentRect = null; if ((Object)(object)val != (Object)null && (Object)(object)val.m_messageText != (Object)null && (Object)(object)((Graphic)val.m_messageText).canvas != (Object)null && (Object)(object)((Graphic)val.m_messageText).canvas.rootCanvas != (Object)null) { parentRect = ((Component)((Graphic)val.m_messageText).canvas.rootCanvas).GetComponent<RectTransform>(); } if (preset == WiresNotificationOverhaulPlugin.PositionPreset.NearCrosshair) { _nextCrosshairSampleTime = 0f; return NearCrosshairPosition(parentRect); } _nextEdgePaddingSampleTime = 0f; Vector2 val2 = BottomRightPadding(parentRect); float num = Mathf.Max(0f, WiresNotificationOverhaulPlugin.IconSize.Value); return new Vector2(0f - val2.x - num, val2.y); } internal static void UpdatePanelPosition() { //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_panel == (Object)null) { return; } RectTransform component = _panel.GetComponent<RectTransform>(); if ((Object)(object)component == (Object)null) { return; } WiresNotificationOverhaulPlugin.PositionPreset value = WiresNotificationOverhaulPlugin.Placement.Value; bool num = value == WiresNotificationOverhaulPlugin.PositionPreset.Default; Transform val = (((Object)(object)_hud != (Object)null) ? ((Component)_hud).transform : ((Transform)component).parent); if (!num && (Object)(object)_hud != (Object)null && (Object)(object)_hud.m_messageText != (Object)null && (Object)(object)((Graphic)_hud.m_messageText).canvas != (Object)null && (Object)(object)((Graphic)_hud.m_messageText).canvas.rootCanvas != (Object)null) { val = ((Component)((Graphic)_hud.m_messageText).canvas.rootCanvas).transform; } if ((Object)(object)val != (Object)null && (Object)(object)((Transform)component).parent != (Object)(object)val) { ((Transform)component).SetParent(val, false); _nextCrosshairSampleTime = 0f; _nextEdgePaddingSampleTime = 0f; KeepBehindInventoryPanels(); } Vector2 val2 = default(Vector2); Vector2 val3 = default(Vector2); switch (value) { case WiresNotificationOverhaulPlugin.PositionPreset.NearCrosshair: ((Vector2)(ref val2))..ctor(0.5f, 0.5f); ((Vector2)(ref val3))..ctor(1f, 0.5f); break; case WiresNotificationOverhaulPlugin.PositionPreset.BottomRight: ((Vector2)(ref val2))..ctor(1f, 0f); ((Vector2)(ref val3))..ctor(1f, 0f); break; default: ((Vector2)(ref val2))..ctor(0f, 1f); ((Vector2)(ref val3))..ctor(0f, 1f); break; } Vector2 value2 = WiresNotificationOverhaulPlugin.NotificationsPosition.Value; if (value == WiresNotificationOverhaulPlugin.PositionPreset.BottomRight) { float value3 = WiresNotificationOverhaulPlugin.NotificationDuration.Value; float num2 = Mathf.Clamp01((_timer - Mathf.Max(0f, value3 - 1f)) / Mathf.Max(0.01f, Mathf.Min(1f, value3))); value2.y -= 22f * num2; } if (component.anchorMin != val2) { component.anchorMin = val2; } if (component.anchorMax != val2) { component.anchorMax = val2; } if (component.pivot != val3) { component.pivot = val3; } if (component.anchoredPosition != value2) { component.anchoredPosition = value2; } VerticalLayoutGroup component2 = _panel.GetComponent<VerticalLayoutGroup>(); if ((Object)(object)component2 != (Object)null) { TextAnchor val4 = (TextAnchor)((value != WiresNotificationOverhaulPlugin.PositionPreset.BottomRight) ? (IsRightAligned() ? 2 : 0) : (IsRightAligned() ? 8 : 6)); if (((LayoutGroup)component2).childAlignment != val4) { ((LayoutGroup)component2).childAlignment = val4; } } } private static void HidePanel() { if ((Object)(object)_panel != (Object)null) { _panel.SetActive(false); } } internal static void ClearNotifications() { ActiveNotifications.Clear(); _timer = 0f; for (int i = 0; i < Entries.Count; i++) { if ((Object)(object)Entries[i].Root != (Object)null && Entries[i].Root.activeSelf) { Entries[i].Root.SetActive(false); } } HidePanel(); if ((Object)(object)_panelGroup != (Object)null) { _panelGroup.alpha = 0f; } } internal static void OnHudDestroyed(MessageHud hud) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_hud != (Object)(object)hud)) { _hud = null; _panel = null; _panelGroup = null; _panelCanvas = null; _inventoryWasVisible = false; _azuQuickbarRect = null; _nextCrosshairSampleTime = 0f; _cachedCrosshairPosition = new Vector2(-85f, 10f); _nextEdgePaddingSampleTime = 0f; _cachedBottomRightPadding = new Vector2(36f, 36f); Entries.Clear(); ActiveNotifications.Clear(); _timer = 0f; } } internal static void Shutdown() { ClearNotifications(); if ((Object)(object)_panel != (Object)null) { Object.Destroy((Object)(object)_panel); } _hud = null; _panel = null; _panelGroup = null; _panelCanvas = null; _inventoryWasVisible = false; _azuQuickbarRect = null; Entries.Clear(); } } internal static class PotionEffectTracker { private sealed class TrackedPotion { internal string ItemNameToken; internal Sprite Icon; internal bool IsCooldown; } internal sealed class UpdateState { internal readonly List<ActivePotion> Active = new List<ActivePotion>(); internal bool Finished; } internal struct ActivePotion { internal int Hash; internal StatusEffect Effect; internal string StopMessage; } private static readonly Dictionary<int, TrackedPotion> Tracked = new Dictionary<int, TrackedPotion>(); private static readonly UpdateState Shared = new UpdateState(); private static readonly List<int> Stale = new List<int>(); internal static void Track(Player player, ItemData item) { if (!((Object)(object)player == (Object)null) && !((Object)(object)player != (Object)(object)Player.m_localPlayer) && item != null && item.m_shared != null && !(item.m_shared.m_food > 0f) && !((Object)(object)item.m_shared.m_consumeStatusEffect == (Object)null)) { StatusEffect consumeStatusEffect = item.m_shared.m_consumeStatusEffect; int num = consumeStatusEffect.NameHash(); if (((Character)player).GetSEMan().HaveStatusEffect(num)) { Tracked[num] = new TrackedPotion { ItemNameToken = item.m_shared.m_name, Icon = item.GetIcon(), IsCooldown = IsCooldownMead(consumeStatusEffect, item.m_shared.m_name) }; } } } internal static UpdateState BeginUpdate(SEMan seman) { if (!IsLocalPlayerSEMan(seman) || Tracked.Count == 0) { return null; } UpdateState shared = Shared; shared.Active.Clear(); shared.Finished = false; Stale.Clear(); foreach (KeyValuePair<int, TrackedPotion> item in Tracked) { StatusEffect statusEffect = seman.GetStatusEffect(item.Key); if ((Object)(object)statusEffect == (Object)null) { Stale.Add(item.Key); continue; } shared.Active.Add(new ActivePotion { Hash = item.Key, Effect = statusEffect, StopMessage = statusEffect.m_stopMessage }); statusEffect.m_stopMessage = ""; } for (int i = 0; i < Stale.Count; i++) { Tracked.Remove(Stale[i]); } return shared; } internal static void EndUpdate(SEMan seman, UpdateState state, bool notify) { if (state == null || state.Finished) { return; } state.Finished = true; for (int i = 0; i < state.Active.Count; i++) { ActivePotion activePotion = state.Active[i]; if (seman != null && seman.HaveStatusEffect(activePotion.Hash)) { if ((Object)(object)activePotion.Effect != (Object)null) { activePotion.Effect.m_stopMessage = activePotion.StopMessage; } continue; } if (notify && Tracked.TryGetValue(activePotion.Hash, out var value) && (Object)(object)activePotion.Effect != (Object)null && activePotion.Effect.m_ttl > 0f && activePotion.Effect.GetRemaningTime() <= 0.05f) { NotificationSystem.ShowPotionEffectEnded(value.ItemNameToken, value.Icon, value.IsCooldown); } Tracked.Remove(activePotion.Hash); } } private static bool IsCooldownMead(StatusEffect effect, string itemNameToken) { string text = (itemNameToken ?? "").ToLowerInvariant(); if (text.Contains("lingering") || text.Contains("resist") || text.Contains("ratatoskr") || text.Contains("tasty")) { return false; } bool flag = (text.Contains("mead") || text.Contains("potion")) && (text.Contains("health") || text.Contains("heal") || text.Contains("stamina") || text.Contains("eitr") || text.Contains("_hp_")); if (effect.m_cooldownIcon) { return true; } SE_Stats val = (SE_Stats)(object)((effect is SE_Stats) ? effect : null); if ((Object)(object)val == (Object)null) { return flag; } float ttl = effect.m_ttl; if (Lasts(val.m_healthOverTime, val.m_healthOverTimeDuration, ttl) || Lasts(val.m_staminaOverTime, val.m_staminaOverTimeDuration, ttl) || Lasts(val.m_eitrOverTime, val.m_eitrOverTimeDuration, ttl) || val.m_healthRegenMultiplier != 1f || val.m_staminaRegenMultiplier != 1f || val.m_eitrRegenMultiplier != 1f || (val.m_mods != null && val.m_mods.Count > 0)) { return false; } return val.m_healthUpFront > 0f || val.m_staminaUpFront > 0f || val.m_eitrUpFront > 0f || val.m_healthOverTime > 0f || val.m_staminaOverTime > 0f || val.m_eitrOverTime > 0f || flag; } private static bool Lasts(float amount, float duration, float ttl) { if (amount != 0f) { if (!(duration <= 0f) && !(ttl <= 0f)) { return duration >= ttl - 0.01f; } return true; } return false; } internal static void Clear() { Tracked.Clear(); } private static bool IsLocalPlayerSEMan(SEMan seman) { if (seman != null && (Object)(object)Player.m_localPlayer != (Object)null) { return ((Character)Player.m_localPlayer).GetSEMan() == seman; } return false; } } [HarmonyPatch(typeof(MessageHud), "ShowMessage")] internal static class MessageHudShowMessagePatch { [HarmonyPrefix] private static bool Prefix(MessageHud __instance, MessageType type, string text, int amount = 0, Sprite icon = null, bool showDespiteHiddenHUD = false) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0060: Unknown result type (might be due to invalid IL or missing references) Sprite icon2; bool flag = RepairMessageCapture.TryGetRepairedIcon(type, text, out icon2); if (flag && (Object)(object)icon2 != (Object)null) { icon = icon2; } Sprite icon3; string shortText; bool flag2 = BuildingRepairCapture.TryGetMessage(type, text, out icon3, out shortText); if (flag2 && (Object)(object)icon3 != (Object)null) { icon = icon3; } Sprite icon4; string compact; bool flag3 = SnapMessageCapture.TryResolve(type, text, out icon4, out compact); if (flag3 && (Object)(object)icon == (Object)null && (Object)(object)icon4 != (Object)null) { icon = icon4; } return !NotificationSystem.TryHandleMessage(__instance, type, text, amount, icon, showDespiteHiddenHUD, flag || flag2, flag2 ? shortText : (flag3 ? compact : null), flag || flag2 || flag3); } } [HarmonyPatch(typeof(MessageHud), "UpdateMessage")] internal static class MessageHudUpdateMessagePatch { [HarmonyPostfix] private static void Postfix(MessageHud __instance, float dt) { NotificationSystem.Tick(__instance, dt); } } [HarmonyPatch(typeof(MessageHud), "HideAll")] internal static class MessageHudHideAllPatch { [HarmonyPostfix] private static void Postfix() { NotificationSystem.ClearNotifications(); } } [HarmonyPatch(typeof(MessageHud), "OnDestroy")] internal static class MessageHudOnDestroyPatch { [HarmonyPostfix] private static void Postfix(MessageHud __instance) { NotificationSystem.OnHudDestroyed(__instance); PotionEffectTracker.Clear(); } } [HarmonyPatch(typeof(Player), "ConsumeItem")] internal static class PlayerConsumePotionPatch { [HarmonyPostfix] private static void Postfix(Player __instance, ItemData item, bool __result) { if (__result) { PotionEffectTracker.Track(__instance, item); } } } [HarmonyPatch(typeof(ItemDrop), "Eat")] internal static class ItemDropEatPotionPatch { [HarmonyPostfix] private static void Postfix(ItemDrop __instance, bool __result) { if (__result && !((Object)(object)__instance == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null)) { PotionEffectTracker.Track(Player.m_localPlayer, __instance.m_itemData); } } } [HarmonyPatch(typeof(SEMan), "Update")] internal static class SEManPotionExpiryPatch { [HarmonyPrefix] private static void Prefix(SEMan __instance, float dt, out PotionEffectTracker.UpdateState __state) { __state = PotionEffectTracker.BeginUpdate(__instance); } [HarmonyPostfix] private static void Postfix(SEMan __instance, PotionEffectTracker.UpdateState __state) { PotionEffectTracker.EndUpdate(__instance, __state, notify: true); } [HarmonyFinalizer] private static Exception Finalizer(SEMan __instance, PotionEffectTracker.UpdateState __state, Exception __exception) { if (__exception != null) { PotionEffectTracker.EndUpdate(__instance, __state, notify: false); } return __exception; } } [HarmonyPatch(typeof(Skills), "RaiseSkill")] internal static class SkillsRaiseSkillPatch { private static readonly MethodInfo GetNextLevelRequirementMethod = AccessTools.Method(typeof(Skill), "GetNextLevelRequirement", (Type[])null, (Type[])null); [HarmonyPrefix] private static void Prefix(Skills __instance, SkillType skillType, float factor, out bool __state) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) __state = factor > 0f && (int)skillType != 0 && (Object)(object)Player.m_localPlayer != (Object)null && (Object)(object)__instance == (Object)(object)((Character)Player.m_localPlayer).GetSkills() && __instance.GetSkillLevel(skillType) < 100f; } [HarmonyPostfix] private static void Postfix(Skills __instance, SkillType skillType, float factor, bool __state) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_005e: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) bool flag = WiresNotificationOverhaulPlugin.XpGainNotifications.Value == WiresNotificationOverhaulPlugin.Toggle.On; bool flag2 = WiresNotificationOverhaulPlugin.InWorldXpPopups.Value == WiresNotificationOverhaulPlugin.Toggle.On; if (flag && ((int)skillType == 102 || (int)skillType == 100) && WiresNotificationOverhaulPlugin.HideRunJumpXp.Value == WiresNotificationOverhaulPlugin.Toggle.On) { flag = false; } if (!__state || (!flag && !flag2)) { return; } SkillDef val = null; for (int i = 0; i < __instance.m_skills.Count; i++) { SkillDef val2 = __instance.m_skills[i]; if (val2 != null && val2.m_skill == skillType) { val = val2; break; } } if (val == null) { return; } float num = val.m_increseStep * factor * Game.m_skillGainRate; if (!(num <= 0f)) { if (flag2) { WorldXpPopups.Show(skillType, num); } if (flag) { float currentXp; float requiredXp; bool hasXpProgress = TryGetProgress(__instance, skillType, out currentXp, out requiredXp); NotificationSystem.ShowSkillXp(val, num, currentXp, requiredXp, hasXpProgress); } } } private static bool TryGetProgress(Skills skills, SkillType skillType, out float currentXp, out float requiredXp) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) currentXp = 0f; requiredXp = 0f; if ((Object)(object)skills == (Object)null) { return false; } List<Skill> skillList = skills.GetSkillList(); for (int i = 0; i < skillList.Count; i++) { Skill val = skillList[i]; if (val == null || val.m_info == null || val.m_info.m_skill != skillType || val.m_level >= 100f) { continue; } currentXp = val.m_accumulator; if (GetNextLevelRequirementMethod != null) { object obj = GetNextLevelRequirementMethod.Invoke(val, null); if (obj is float) { requiredXp = (float)obj; return requiredXp > 0f; } } requiredXp = Mathf.Pow(Mathf.Floor(val.m_level + 1f), 1.5f) * 0.5f + 0.5f; return requiredXp > 0f; } return false; } } [BepInPlugin("wire.valheim.notificationoverhaul", "Wire's Notification Overhaul", "1.1.11")] public sealed class WiresNotificationOverhaulPlugin : BaseUnityPlugin { internal enum Toggle { Off, On } internal sealed class ConfigurationManagerAttributes { public int Order { get; set; } } internal enum PositionPreset { Default, NearCrosshair, BottomRight } internal enum TextAlignment { Left, Right } public const string PluginGuid = "wire.valheim.notificationoverhaul"; public const string PluginName = "Wire's Notification Overhaul"; public const string PluginVersion = "1.1.11"; internal static ConfigEntry<PositionPreset> Placement; internal static ConfigEntry<TextAlignment> NotificationAlignment; internal static ConfigEntry<float> IconSize; internal static ConfigEntry<Toggle> CompactMode; internal static ConfigEntry<Toggle> GroupUnlockNotifications; internal static ConfigEntry<float> NotificationDuration; internal static ConfigEntry<int> MaxVisibleNotifications; internal static ConfigEntry<Toggle> PickupNotificationsOnly; internal static ConfigEntry<Vector2> NotificationsPosition; internal static ConfigEntry<float> NotificationsFontSize; internal static ConfigEntry<Color> NotificationTextColor; internal static ConfigEntry<Toggle> MoveCenterNotifications; internal static ConfigEntry<Toggle> PreserveCenterMessageColor; internal static ConfigEntry<Toggle> XpGainNotifications; internal static ConfigEntry<Toggle> XpProgressNotifications; internal static ConfigEntry<Toggle> InWorldXpPopups; internal static ConfigEntry<Toggle> HideMovementXpPopups; internal static ConfigEntry<Toggle> HideRunJumpXp; internal static ConfigEntry<Toggle> XpProgressPercent; private Harmony _harmony; private static bool _pendingPreviousPresetMigration; private void Awake() { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown bool flag = false; try { if (File.Exists(((BaseUnityPlugin)this).Config.ConfigFilePath)) { using StreamReader streamReader = new StreamReader(((BaseUnityPlugin)this).Config.ConfigFilePath); string text = streamReader.ReadLine(); int num = text?.LastIndexOf(" v", StringComparison.Ordinal) ?? (-1); if (num >= 0 && Version.TryParse(text.Substring(num + 2), out Version result)) { flag = result < new Version(1, 0, 64); } } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Unable to inspect earlier position settings: " + ex.Message)); } try { PositionSettingsMigration.Migrate(((BaseUnityPlugin)this).Config); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Position config migration failed; continuing with defaults: " + ex2.Message)); } BindConfig(); _pendingPreviousPresetMigration = flag && Placement.Value != PositionPreset.Default; _harmony = new Harmony("wire.valheim.notificationoverhaul"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Wire's Notification Overhaul 1.1.11 loaded."); } private void BindConfig() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Expected O, but got Unknown //IL_01e9: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; CompactMode = ((BaseUnityPlugin)this).Config.Bind<Toggle>("2- General", "Compact Mode", Toggle.Off, "Show short, icon-first notification text. Yellow center-screen messages are compacted only when moved into the left stack."); GroupUnlockNotifications = ((BaseUnityPlugin)this).Config.Bind<Toggle>("3- Notification Sources", "Grouped Unlock Notifications", Toggle.On, "Replace vanilla unlock popups and generic new-unlocks count with one stacked message per actual crafting station/category, cycling the icons of the exact unlocks every 0.5 seconds. Unlocks and compendium history remain intact."); Placement = ((BaseUnityPlugin)this).Config.Bind<PositionPreset>("3- Position", "Position Preset", PositionPreset.Default, new ConfigDescription("Apply a preset to Notification Text Alignment and Notification Panel Position. You can freely edit both afterward. Default = top left; NearCrosshair = to the left of the crosshair; BottomRight = screen corner.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 300 } })); NotificationAlignment = ((BaseUnityPlugin)this).Config.Bind<TextAlignment>("3- Position", "Notification Text Alignment", TextAlignment.Left, new ConfigDescription("Left puts icons before left-aligned text. Right puts icons after right-aligned text. Presets set this automatically, but manual changes are respected.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 200 } })); IconSize = ((BaseUnityPlugin)this).Config.Bind<float>("2- General", "Icon Size", 28f, new ConfigDescription("Size of notification icons in UI units, in all placements.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(12f, 72f), Array.Empty<object>())); NotificationDuration = BindLocal("2- General", "Notification Duration", 4f, "How long the notification stays visible.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f)); MaxVisibleNotifications = BindLocal("2- General", "Max Visible Notifications", 5, "How many notifications are visible at the same time.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10)); PickupNotificationsOnly = BindLocal("2- General", "Pickup Notifications Only", Toggle.Off, "Only pickup notifications are added to the custom notification panel."); NotificationsPosition = ((BaseUnityPlugin)this).Config.Bind<Vector2>("3- Position", "Notification Panel Position", new Vector2(40f, -160f), new ConfigDescription("Editable hard panel coordinates. The selected preset fills in this value once; editing it later moves the notifications without being overridden.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 100 } })); NotificationsFontSize = BindLocal("2- General", "Text Font Size", 18f, "Notification panel text font size."); NotificationTextColor = BindLocal<Color>("2- General", "Text Color", Color.white, "Notification text color."); MoveCenterNotifications = BindLocal("3- Notification Sources", "Move Center Notifications To Stack", Toggle.On, "Move Valheim's large yellow center-screen notifications into the left notification stack instead."); PreserveCenterMessageColor = BindLocal("3- Notification Sources", "Preserve Center Message Color", Toggle.On, "Keep the original yellow center-message color when those messages are moved into the left stack."); XpGainNotifications = BindOrdered("4- XP Notifications", "XP Gain Notifications", Toggle.Off, "Show skill XP gains in the notification stack, not only level-ups.", 400); HideRunJumpXp = BindOrdered("4- XP Notifications", "No Notifications For Running And Jumping", Toggle.On, "With XP Gain Notifications, leave out Run and Jump XP, which come in about once a second while you move. Their level-ups still show.", 350); XpProgressNotifications = BindOrdered("4- XP Notifications", "Show Current / Required XP", Toggle.Off, "With XP Gain Notifications, show current XP toward the next level out of the XP required for that level.", 300); XpProgressPercent = BindOrdered("4- XP Notifications", "Show XP Progress As Percent", Toggle.On, "With XP Gain Notifications, show how far the skill is toward its next level in percent, with one decimal (100.5/200xp shows as 50.3%). Takes the place of the gained XP and of Show Current / Required XP.", 250); InWorldXpPopups = BindOrdered("4- XP Notifications", "In-World XP Popups", Toggle.Off, "Show each XP gain as a popup on your character, in the same style as damage numbers. Works with or without XP Gain Notifications. Only you see them.", 200); HideMovementXpPopups = BindOrdered("4- XP Notifications", "No In-World Popups For Movement Skills", Toggle.On, "Skip in-world popups for Run, Jump, Swim, Ride and Sneak, which gain XP about once a second while moving. The notification stack is unaffected.", 100); if (TakeOrphan("3- Notification Sources", "XP Gain Notifications", out var value)) { XpGainNotifications.Value = ParseToggle(value, XpGainNotifications.Value); } if (TakeOrphan("3- Notification Sources", "Show Current / Required XP", out value)) { XpProgressNotifications.Value = ParseToggle(value, XpProgressNotifications.Value); } PickupNo