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; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Ezomic.Core; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("Thijssen Software")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright (c) 2026 Robbin Thijssen")] [assembly: AssemblyDescription("A character level beside the skills, paid out in cards you draft and deepen.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+0c1a85d6e370184385c49006a5a6fd9ea9011ae7")] [assembly: AssemblyProduct("Rist")] [assembly: AssemblyTitle("Rist")] [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 Rist { internal static class AttackSpeed { internal const string Melee = "*attackspeed:melee"; internal const string Tools = "*attackspeed:tools"; internal const string Ranged = "*attackspeed:ranged"; private static string CategoryOf(ItemData weapon) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0059: Expected I4, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Invalid comparison between Unknown and I4 if (weapon == null || weapon.m_shared == null) { return null; } SkillType skillType = weapon.m_shared.m_skillType; switch (skillType - 1) { case 7: case 13: return "*attackspeed:ranged"; case 6: case 11: case 12: return "*attackspeed:tools"; case 0: case 1: case 2: case 3: case 4: case 10: return "*attackspeed:melee"; default: if ((int)weapon.m_shared.m_itemType != 19) { return null; } return "*attackspeed:tools"; } } [HarmonyPatch(typeof(Attack), "Start")] [HarmonyPostfix] private static void Started(bool __result, Humanoid character, CharacterAnimEvent animEvent, ItemData weapon) { if (!__result || !RistConfig.Enabled.Value || (Object)(object)character == (Object)null || (Object)(object)animEvent == (Object)null || (object)character != Player.m_localPlayer) { return; } string text = CategoryOf(weapon); if (text != null) { float num = Effects.TotalFor(text); if (!(num <= 0f)) { num = Mathf.Min(num, Mathf.Max(0f, RistConfig.AttackSpeedMax.Value)); animEvent.Speed(1f + num); } } } } internal sealed class Card { internal string Id; internal string Name; internal string Flavour; internal string Effect; internal float PerRank; internal string BonusEffect = ""; internal float BonusPerRank; internal string Sigil = ""; internal FieldInfo Field; internal FieldInfo BonusField; private static readonly HashSet OneBased = new HashSet { "m_healthRegenMultiplier", "m_staminaRegenMultiplier", "m_eitrRegenMultiplier", "m_damageModifier" }; private static readonly Dictionary Labels = new Dictionary { { "m_addMaxCarryWeight", "carry weight" }, { "m_addArmor", "armour" }, { "*inventoryrow", "inventory row" }, { "m_runStaminaUseModifier", "run stamina" }, { "m_attackStaminaUseModifier", "attack stamina" }, { "m_blockStaminaUseModifier", "block stamina" }, { "m_swimStaminaUseModifier", "swim stamina" }, { "m_jumpStaminaUseModifier", "jump stamina" }, { "m_sneakStaminaUseModifier", "sneak stamina" }, { "m_staminaRegenMultiplier", "stamina regen" }, { "m_healthRegenMultiplier", "health regen" }, { "m_eitrRegenMultiplier", "eitr regen" }, { "m_fallDamageModifier", "fall damage" }, { "m_stealthModifier", "stealth" }, { "m_noiseModifier", "noise" }, { "m_staggerModifier", "stagger taken" }, { "m_raiseSkillModifier", "skill gain" }, { "m_speedModifier", "movement speed" }, { "m_damageModifier", "damage" }, { "m_dodgeStaminaUseModifier", "dodge stamina" }, { "m_swimSpeedModifier", "swim speed" }, { "m_timedBlockBonus", "parry bonus" }, { "*stamina:move", "movement stamina" }, { "*stamina:fight", "combat stamina" }, { "*attackspeed:melee", "melee speed" }, { "*attackspeed:tools", "tool speed" }, { "*attackspeed:ranged", "draw speed" } }; private static readonly HashSet Percent = new HashSet { "m_runStaminaUseModifier", "m_attackStaminaUseModifier", "m_blockStaminaUseModifier", "m_swimStaminaUseModifier", "m_jumpStaminaUseModifier", "m_sneakStaminaUseModifier", "m_staminaRegenMultiplier", "m_healthRegenMultiplier", "m_eitrRegenMultiplier", "m_fallDamageModifier", "m_stealthModifier", "m_noiseModifier", "m_staggerModifier", "m_raiseSkillModifier", "m_speedModifier", "m_damageModifier", "m_dodgeStaminaUseModifier", "m_swimSpeedModifier", "m_timedBlockBonus", "*attackspeed:melee", "*attackspeed:tools", "*attackspeed:ranged", "*stamina:move", "*stamina:fight" }; internal static readonly HashSet Specials = new HashSet { "*inventoryrow", "*attackspeed:melee", "*attackspeed:tools", "*attackspeed:ranged", "*stamina:move", "*stamina:fight" }; internal bool IsSpecial => IsSpecialEffect(Effect); internal bool HasBonus => BonusEffect.Length > 0; internal static bool IsSpecialEffect(string effect) { if (effect != null && effect.Length > 0) { return effect[0] == '*'; } return false; } internal static int BonusTimes(int rank) { int num = Mathf.Max(1, RistConfig.BonusEvery.Value); return rank / num; } internal string Describe(int rank) { return Format(Effect, PerRank * (float)Mathf.Max(1, rank)); } internal string DescribeBonus(int times) { return Format(BonusEffect, BonusPerRank * (float)Mathf.Max(1, times)); } private static string Format(string effect, float total) { if (!Labels.TryGetValue(effect, out var value)) { value = effect; } if (Percent.Contains(effect)) { float num = total * 100f; return ((num >= 0f) ? "+" : "−") + Mathf.Abs(num).ToString("0.#", CultureInfo.InvariantCulture) + "% " + value; } return ((total >= 0f) ? "+" : "−") + Mathf.Abs(total).ToString("0.#", CultureInfo.InvariantCulture) + " " + value; } internal static bool IsOneBased(string effect) { return OneBased.Contains(effect); } } internal static class Cards { private static readonly List _all = new List(); private static readonly Dictionary _byId = new Dictionary(); internal static IReadOnlyList All => _all; internal static Card Get(string id) { if (id == null || !_byId.TryGetValue(id, out var value)) { return null; } return value; } internal static void Load() { _all.Clear(); _byId.Clear(); string text = Path.Combine(Path.GetDirectoryName(typeof(Cards).Assembly.Location) ?? ".", "cards.txt"); if (!File.Exists(text)) { RistPlugin.Log.LogError((object)("cards.txt not found beside the DLL at " + text + " - no cards can be taken.")); return; } if (RistPlugin.CorePresent) { DeclareCatalogue(File.ReadAllText(text)); } int num = 0; string[] array = File.ReadAllLines(text); foreach (string obj in array) { num++; string text2 = obj.Trim(); if (text2.Length == 0 || text2[0] == '#') { continue; } string[] array2 = text2.Split(new char[1] { '|' }); if (array2.Length < 5) { RistPlugin.Log.LogWarning((object)("cards.txt line " + num + ": expected 5 fields, got " + array2.Length + " - skipped.")); continue; } Card card = new Card { Id = array2[0].Trim(), Name = array2[1].Trim(), Flavour = array2[2].Trim(), Effect = array2[3].Trim() }; if (!float.TryParse(array2[4].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out card.PerRank)) { RistPlugin.Log.LogWarning((object)("cards.txt line " + num + ": '" + array2[4].Trim() + "' is not a number - skipped.")); } else if (card.Id.Length == 0) { RistPlugin.Log.LogWarning((object)("cards.txt line " + num + ": blank id - skipped.")); } else if (_byId.ContainsKey(card.Id)) { RistPlugin.Log.LogWarning((object)("cards.txt line " + num + ": duplicate id '" + card.Id + "' - skipped.")); } else { if (!Resolve(card.Effect, num, card.Id, out card.Field)) { continue; } if (array2.Length >= 8) { card.Sigil = array2[7].Trim(); } if (array2.Length >= 7) { card.BonusEffect = array2[5].Trim(); string text3 = array2[6].Trim(); if (card.BonusEffect.Length > 0) { if (!float.TryParse(text3, NumberStyles.Float, CultureInfo.InvariantCulture, out card.BonusPerRank)) { RistPlugin.Log.LogWarning((object)("cards.txt line " + num + ": bonus value '" + text3 + "' is not a number - bonus dropped.")); card.BonusEffect = ""; } else if (!Resolve(card.BonusEffect, num, card.Id, out card.BonusField)) { card.BonusEffect = ""; } } } _all.Add(card); _byId[card.Id] = card; } } RistPlugin.Log.LogInfo((object)("Loaded " + _all.Count + " cards from cards.txt.")); } private static bool Resolve(string effect, int lineNo, string id, out FieldInfo field) { field = null; if (Card.IsSpecialEffect(effect)) { if (Card.Specials.Contains(effect)) { return true; } RistPlugin.Log.LogWarning((object)("cards.txt line " + lineNo + ": unknown special '" + effect + "' - card '" + id + "' skipped.")); return false; } field = typeof(SE_Stats).GetField(effect, BindingFlags.Instance | BindingFlags.Public); if (field != null && field.FieldType == typeof(float)) { return true; } RistPlugin.Log.LogWarning((object)("cards.txt line " + lineNo + ": SE_Stats has no public float field '" + effect + "' - card '" + id + "' skipped.")); field = null; return false; } [MethodImpl(MethodImplOptions.NoInlining)] private static void DeclareCatalogue(string contents) { Suite.Data(contents, (string)null); } } [HarmonyPatch(typeof(Skills), "OnDeath")] internal static class DeathPenalty { private static bool Prefix() { return !RistConfig.RemoveDeathSkillLoss.Value; } } internal static class Effects { private const string EffectName = "Rist"; private static readonly int EffectHash = StringExtensionMethods.GetStableHashCode("Rist"); private static SE_Stats _applied; private static string _appliedSignature; private static Player _appliedTo; private static readonly Dictionary Spread = new Dictionary { { "*stamina:move", new string[5] { "m_runStaminaUseModifier", "m_jumpStaminaUseModifier", "m_dodgeStaminaUseModifier", "m_swimStaminaUseModifier", "m_sneakStaminaUseModifier" } }, { "*stamina:fight", new string[2] { "m_attackStaminaUseModifier", "m_blockStaminaUseModifier" } } }; internal static int ExtraRows { get; private set; } internal static void Reset() { if ((Object)(object)_applied != (Object)null) { Object.Destroy((Object)(object)_applied); } _applied = null; _appliedSignature = null; _appliedTo = null; } internal static void Apply(Player player, Dictionary ranks) { if ((Object)(object)player == (Object)null) { return; } string text = Signature(ranks); if (player != _appliedTo || !(text == _appliedSignature)) { _appliedTo = player; _appliedSignature = text; ApplyStats(player, ranks); ApplyInventoryRows(player, ranks); if (RistConfig.Verbose.Value) { RistPlugin.Log.LogInfo((object)("Applied cards: " + ((text.Length == 0) ? "(none)" : text))); } } } private static Dictionary Totals(Dictionary ranks) { Dictionary dictionary = new Dictionary(); if (ranks == null) { return dictionary; } foreach (KeyValuePair rank in ranks) { if (rank.Value <= 0) { continue; } Card card = Cards.Get(rank.Key); if (card == null) { continue; } Add(dictionary, card.Effect, card.PerRank * (float)rank.Value); if (card.HasBonus) { int num = Card.BonusTimes(rank.Value); if (num > 0) { Add(dictionary, card.BonusEffect, card.BonusPerRank * (float)num); } } } return dictionary; } private static void Add(Dictionary totals, string effect, float amount) { if (string.IsNullOrEmpty(effect)) { return; } if (Spread.TryGetValue(effect, out var value)) { string[] array = value; foreach (string effect2 in array) { Add(totals, effect2, amount); } } else { totals.TryGetValue(effect, out var value2); totals[effect] = value2 + amount; } } internal static float TotalFor(string effect) { if (!ClientState.Known || string.IsNullOrEmpty(effect)) { return 0f; } if (!Totals(ClientState.Ranks).TryGetValue(effect, out var value)) { return 0f; } return value; } private static void ApplyStats(Player player, Dictionary ranks) { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) SEMan sEMan = ((Character)player).GetSEMan(); if (sEMan == null) { return; } Dictionary dictionary = new Dictionary(); foreach (KeyValuePair item in Totals(ranks)) { if (!Card.IsSpecialEffect(item.Key)) { FieldInfo field = typeof(SE_Stats).GetField(item.Key, BindingFlags.Instance | BindingFlags.Public); if (!(field == null) && !(field.FieldType != typeof(float))) { dictionary[field] = item.Value; } } } sEMan.RemoveStatusEffect(EffectHash, true); if ((Object)(object)_applied != (Object)null) { Object.Destroy((Object)(object)_applied); _applied = null; } if (dictionary.Count == 0) { return; } SE_Stats val = ScriptableObject.CreateInstance(); ((Object)val).name = "Rist"; ((StatusEffect)val).m_name = "Rist"; ((StatusEffect)val).m_ttl = 0f; val.m_raiseSkill = (SkillType)999; val.m_modifyAttackSkill = (SkillType)999; val.m_skillLevel = (SkillType)999; foreach (KeyValuePair item2 in dictionary) { float num = (Card.IsOneBased(item2.Key.Name) ? (1f + item2.Value) : item2.Value); item2.Key.SetValue(val, num); } sEMan.AddStatusEffect((StatusEffect)(object)val, false, 0, 0f); _applied = val; } private static void ApplyInventoryRows(Player player, Dictionary ranks) { Totals(ranks).TryGetValue("*inventoryrow", out var value); ExtraRows = Mathf.Max(0, Mathf.RoundToInt(value)); if (RistPlugin.CorePresent) { ClaimThroughCore(ExtraRows); } else { OwnInventoryRows.Claimed = ExtraRows; } } [MethodImpl(MethodImplOptions.NoInlining)] private static void ClaimThroughCore(int rows) { InventoryRows.Claim("ezomic.valheim.rist", rows); } private static string Signature(Dictionary ranks) { if (ranks == null || ranks.Count == 0) { return ""; } List list = new List(ranks.Keys); list.Sort(); StringBuilder stringBuilder = new StringBuilder(); foreach (string item in list) { if (stringBuilder.Length > 0) { stringBuilder.Append(','); } stringBuilder.Append(item).Append(':').Append(ranks[item]); } return stringBuilder.ToString(); } } internal static class Gate { private static readonly HashSet Baselined = new HashSet(StringComparer.Ordinal); internal static bool HasBaseline(string owner) { if (owner != null) { return Baselined.Contains(owner); } return false; } internal static void Forget() { Baselined.Clear(); } internal static string LocalSkills() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected I4, but got Unknown Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return ""; } Skills skills = ((Character)localPlayer).GetSkills(); if ((Object)(object)skills == (Object)null) { return ""; } StringBuilder stringBuilder = new StringBuilder(); foreach (Skill skill in skills.GetSkillList()) { if (skill != null && skill.m_info != null) { if (stringBuilder.Length > 0) { stringBuilder.Append(','); } stringBuilder.Append((int)skill.m_info.m_skill).Append(':').Append(skill.m_level.ToString("R", CultureInfo.InvariantCulture)); } } return stringBuilder.ToString(); } internal static void Judge(long sender, string owner, string facts, string skills) { if (!RistConfig.CheckSkillBaseline.Value || string.IsNullOrEmpty(owner)) { return; } Dictionary dictionary = ParseSkills(skills); if (dictionary == null) { return; } RistRecord ristRecord = Ledger.For(owner); if (ristRecord == null) { return; } bool flag = !ristRecord.HasSnapshot; Baselined.Add(owner); int num = 0; foreach (KeyValuePair item in dictionary) { if (!ristRecord.Snapshot.TryGetValue(item.Key, out var value) || !(item.Value <= value)) { ristRecord.Snapshot[item.Key] = item.Value; num++; } } if (num > 0) { Ledger.Touch(); } if (flag) { RistPlugin.Log.LogInfo((object)("Baseline adopted for " + owner + " (" + dictionary.Count + " skills).")); } else if (num > 0 && RistConfig.Verbose.Value) { RistPlugin.Log.LogInfo((object)("Baseline for " + owner + " raised on " + num + " skill(s).")); } if (Credit(sender, owner, ristRecord, dictionary)) { Net.PushState(sender, ristRecord); } } private static bool Credit(long sender, string owner, RistRecord rec, Dictionary reported) { if (!RistConfig.CreditExistingSkills.Value) { return false; } float num = 0f; foreach (KeyValuePair item in reported) { float value = item.Value; if (value > 0f) { num += value * (value + 1f) * 0.5f; } } num *= RistConfig.XpPerSkillLevel.Value; if (num <= rec.Xp + 0.001f) { return false; } int level = rec.Level; rec.Xp = num; Ledger.Touch(); RistPlugin.Log.LogInfo((object)("Credited " + owner + " for skills already held: " + num.ToString("0") + " xp, Rist level " + level + " -> " + rec.Level + ".")); return true; } private static Dictionary ParseSkills(string wire) { if (wire == null) { return null; } Dictionary dictionary = new Dictionary(); string[] array = wire.Split(new char[1] { ',' }); foreach (string text in array) { if (text.Length != 0) { string[] array2 = text.Split(new char[1] { ':' }); if (array2.Length == 2 && int.TryParse(array2[0], out var result) && float.TryParse(array2[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result2)) { dictionary[result] = result2; } } } return dictionary; } } internal static class HudBar { private const float BorderBuffer = 16f; private static GameObject _root; private static RectTransform _rect; private static GuiBar _fast; private static GuiBar _slow; private static TMP_Text _text; private static Animator _animator; private static Canvas _canvas; private static bool _hasVisible; private static bool _hasFlash; private static bool _failed; private static float _nextFlash; private static int _shownLevel = -1; private static int _shownPercent = -1; private static bool _shownOwed; private static float _sizedAt; private static float _trail = -1f; private const float TrailSpeed = 0.5f; private static bool _uprightAt; private static string _tintedAt; internal static bool Live => (Object)(object)_root != (Object)null; internal static bool HasText => (Object)(object)_text != (Object)null; internal static float HalfLength { get { float num = (((Object)(object)_canvas != (Object)null) ? _canvas.scaleFactor : 1f); return Mathf.Max(16f, RistConfig.BarSize.Value) * 0.5f * num; } } internal static void Update() { if (!RistConfig.Enabled.Value || !RistConfig.ShowXpBar.Value || !RistConfig.VanillaBar.Value) { Drop(); } else if ((Object)(object)Hud.instance == (Object)null || (Object)(object)Player.m_localPlayer == (Object)null) { Drop(); } else { if ((Object)(object)_root == (Object)null && !Build()) { return; } bool flag = Visible(); if (_root.activeSelf != flag) { _root.SetActive(flag); } if (flag) { Place(); if (!Mathf.Approximately(_sizedAt, RistConfig.BarSize.Value)) { Size(); } if (_uprightAt != RistConfig.BarUpright.Value) { Lay(); } if (_tintedAt != RistConfig.BarColour.Value) { Colour(); } float num = Mathf.Clamp01(Levels.Progress(ClientState.Xp)); Fill(num); int num2 = Mathf.Clamp(Mathf.RoundToInt(num * 100f), 0, 100); bool hasPick = ClientState.HasPick; if ((Object)(object)_text != (Object)null && (_shownLevel != ClientState.Level || _shownPercent != num2 || _shownOwed != hasPick)) { _shownLevel = ClientState.Level; _shownPercent = num2; _shownOwed = hasPick; _text.text = _shownLevel + " · " + num2 + "%" + (ClientState.HasPick ? " ★" : ""); } Announce(); } } } private static bool Visible() { if (!ClientState.Known) { return false; } if (((Character)Player.m_localPlayer).IsDead()) { return false; } return !Hud.instance.m_userHidden; } private static void Announce() { if (_hasFlash && ClientState.HasPick && !(Time.time < _nextFlash)) { _nextFlash = Time.time + Mathf.Max(1f, RistConfig.BarFlashSeconds.Value); _animator.SetTrigger("Flash"); } } private static bool Build() { if (_failed) { return false; } RectTransform val = (((Object)(object)Hud.instance.m_eitrBarRoot != (Object)null) ? Hud.instance.m_eitrBarRoot : Hud.instance.m_staminaBar2Root); if ((Object)(object)val == (Object)null || (Object)(object)((Transform)val).parent == (Object)null) { Fail("no upright bar to clone from - falling back to the plain bar."); return false; } GameObject val2 = Object.Instantiate(((Component)val).gameObject, ((Transform)val).parent); ((Object)val2).name = "RistXpBar"; val2.SetActive(true); _rect = val2.GetComponent(); _canvas = val2.GetComponentInParent(); GuiBar[] componentsInChildren = val2.GetComponentsInChildren(true); foreach (GuiBar val3 in componentsInChildren) { if (val3.m_smoothDrain || val3.m_smoothFill) { if ((Object)(object)_slow == (Object)null) { _slow = val3; } } else if ((Object)(object)_fast == (Object)null) { _fast = val3; } } if ((Object)(object)_fast == (Object)null) { _fast = _slow; } if ((Object)(object)_slow == (Object)null) { _slow = _fast; } if ((Object)(object)_fast == (Object)null) { Object.Destroy((Object)(object)val2); Fail("the cloned bar has no GuiBar - falling back to the plain bar."); return false; } _text = val2.GetComponentInChildren(true); _animator = val2.GetComponent(); if ((Object)(object)_animator == (Object)null) { _animator = val2.GetComponentInChildren(true); } ReadParameters(); Size(); Colour(); Lay(); if (_hasVisible) { _animator.SetBool("Visible", true); } else { Unfade(val2); } _root = val2; _shownLevel = -1; _trail = -1f; RistPlugin.Log.LogInfo((object)("Experience bar cloned from " + ((Object)val).name + ".")); return true; } private static void Unfade(GameObject go) { //IL_0068: 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_006f: 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) if ((Object)(object)_animator != (Object)null) { Object.Destroy((Object)(object)_animator); } _animator = null; _hasFlash = false; CanvasGroup[] componentsInChildren = go.GetComponentsInChildren(true); foreach (CanvasGroup val in componentsInChildren) { if (val.alpha < 0.05f) { val.alpha = 1f; } } Graphic[] componentsInChildren2 = go.GetComponentsInChildren(true); foreach (Graphic val2 in componentsInChildren2) { Color color = val2.color; if (!(color.a >= 0.05f)) { color.a = 1f; val2.color = color; } } RistPlugin.Log.LogInfo((object)"Cloned bar has no Visible animator parameter; unfaded by hand."); } private static void ReadParameters() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Invalid comparison between Unknown and I4 _hasVisible = false; _hasFlash = false; if ((Object)(object)_animator == (Object)null || (Object)(object)_animator.runtimeAnimatorController == (Object)null) { return; } AnimatorControllerParameter[] parameters = _animator.parameters; foreach (AnimatorControllerParameter val in parameters) { if ((int)val.type == 4 && val.name == "Visible") { _hasVisible = true; } if ((int)val.type == 9 && val.name == "Flash") { _hasFlash = true; } } } private static void Size() { _sizedAt = RistConfig.BarSize.Value; float num = Mathf.Max(16f, _sizedAt); _rect.SetSizeWithCurrentAnchors((Axis)0, num + 16f); if (RistConfig.Verbose.Value) { RistPlugin.Log.LogInfo((object)("Bar sized to " + num + ".")); } } private static void Fill(float progress) { float num = Mathf.Max(16f, RistConfig.BarSize.Value); if (_trail < 0f || progress > _trail) { _trail = progress; } else { _trail = Mathf.MoveTowards(_trail, progress, Time.deltaTime * 0.5f); } Draw(_slow, num * Mathf.Max(_trail, progress)); Draw(_fast, num * progress); } private static void Draw(GuiBar bar, float width) { if (!((Object)(object)bar == (Object)null) && !((Object)(object)bar.m_bar == (Object)null)) { bar.m_bar.SetSizeWithCurrentAnchors((Axis)0, Mathf.Max(0f, width)); } } private static void Lay() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) _uprightAt = RistConfig.BarUpright.Value; if (!((Object)(object)_rect == (Object)null)) { ((Transform)_rect).rotation = (_uprightAt ? Quaternion.Euler(0f, 0f, 90f) : Quaternion.identity); } } private static void Colour() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) _tintedAt = RistConfig.BarColour.Value; Color val = RistConfig.BarTint(); Tint(_fast, val); Tint(_slow, new Color(val.r * 0.55f, val.g * 0.55f, val.b * 0.55f, val.a)); if ((Object)(object)_text != (Object)null) { ((Graphic)_text).color = val; } } private unsafe static void Tint(GuiBar bar, Color colour) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)bar == (Object)null) { return; } bar.SetColor(colour); if ((Object)(object)bar.m_bar == (Object)null) { return; } Image component = ((Component)bar.m_bar).GetComponent(); if (!((Object)(object)component == (Object)null)) { if (RistConfig.Verbose.Value && ((Graphic)component).color != colour) { ManualLogSource log = RistPlugin.Log; string[] obj = new string[9] { "Bar fill '", ((Object)component).name, "' was ", ((object)((Graphic)component).color/*cast due to .constrained prefix*/).ToString(), " (sprite ", ((Object)(object)component.sprite != (Object)null) ? ((Object)component.sprite).name : "none", "); set to ", null, null }; Color val = colour; obj[7] = ((object)(*(Color*)(&val))/*cast due to .constrained prefix*/).ToString(); obj[8] = "."; log.LogInfo((object)string.Concat(obj)); } ((Graphic)component).color = colour; } } private static void Place() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) Transform parent = ((Transform)_rect).parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); if ((Object)(object)val == (Object)null) { return; } bool flag = ((Object)(object)Hud.instance.m_buildHud != (Object)null && Hud.instance.m_buildHud.activeSelf) || ((Object)(object)Hud.instance.m_shipHudRoot != (Object)null && Hud.instance.m_shipHudRoot.activeSelf); Camera val2 = (((Object)(object)_canvas != (Object)null && (int)_canvas.renderMode != 0) ? _canvas.worldCamera : null); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(RistConfig.BarPosX.Value, RistConfig.BarPosY.Value + (flag ? RistConfig.BarBuildRaise.Value : 0f)); if (RistConfig.BarFollowStamina.Value) { RectTransform staminaBar2Root = Hud.instance.m_staminaBar2Root; if ((Object)(object)staminaBar2Root != (Object)null) { Vector2 val4 = RectTransformUtility.WorldToScreenPoint(val2, ((Transform)staminaBar2Root).position); ((Vector2)(ref val3))..ctor(val4.x + RistConfig.BarOffsetX.Value, val4.y - RistConfig.BarOffsetY.Value); } } Vector3 position = default(Vector3); if (RectTransformUtility.ScreenPointToWorldPointInRectangle(val, val3, val2, ref position)) { ((Transform)_rect).position = position; } } private static void Fail(string why) { _failed = true; RistPlugin.Log.LogWarning((object)("Rist: " + why)); } internal static void Drop() { if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } _root = null; _rect = null; _fast = null; _slow = null; _text = null; _animator = null; _canvas = null; _shownLevel = -1; _trail = -1f; _shownPercent = -1; _sizedAt = 0f; _tintedAt = null; _failed = false; } } internal static class InfoTab { [CompilerGenerated] private static class <>O { public static UnityAction <0>__Open; } private static GameObject _tab; private static InventoryGui _seen; private static Sprite _icon; private static bool _failed; internal static void Update() { if (!_failed && RistConfig.Enabled.Value && RistConfig.ShowInfoTab.Value) { InventoryGui instance = InventoryGui.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.m_infoPanel == (Object)null) { _seen = null; } else if (instance != _seen || !((Object)(object)_tab != (Object)null)) { _seen = instance; Build(instance); } } } private static void Build(InventoryGui gui) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown Button val = Donor(gui); if ((Object)(object)val == (Object)null) { _failed = true; RistPlugin.Log.LogWarning((object)"No compendium tab to clone, and there is no keybind any more - the rists panel has no way in. That is a bug rather than a setting; please report it."); return; } GameObject val2 = Object.Instantiate(((Component)val).gameObject, ((Component)val).transform.parent); ((Object)val2).name = "RistTab"; Button component = val2.GetComponent