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 SkillMastery v1.1.0
BepInEx/plugins/SkillMastery/SkillMastery.dll
Decompiled a month agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] namespace SkillMastery; [BepInPlugin("pasca.valheim.skillmastery", "Skill Mastery", "1.1.0")] public sealed class SkillMasteryPlugin : BaseUnityPlugin { public const string PluginGuid = "pasca.valheim.skillmastery"; public const string PluginName = "Skill Mastery"; public const string PluginVersion = "1.1.0"; private Harmony _harmony; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown _harmony = new Harmony("pasca.valheim.skillmastery"); _harmony.PatchAll(typeof(SkillMasteryPlugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Skill Mastery 1.1.0 loaded."); } private void OnDestroy() { if (_harmony != null) { _harmony.UnpatchSelf(); } } internal static bool IsMastered(Skill skill) { if (skill != null) { return skill.m_level >= 100f; } return false; } } [HarmonyPatch(typeof(Skills), "LowerAllSkills")] internal static class PreserveMasteredSkillsPatch { private sealed class SkillSnapshot { internal Skill Skill; internal float Level; internal float Accumulator; } [HarmonyPriority(800)] [HarmonyPrefix] private static void CaptureMasteredSkills(Skills __instance, out List<SkillSnapshot> __state) { __state = new List<SkillSnapshot>(); List<Skill> skillList = __instance.GetSkillList(); for (int i = 0; i < skillList.Count; i++) { Skill val = skillList[i]; if (SkillMasteryPlugin.IsMastered(val)) { __state.Add(new SkillSnapshot { Skill = val, Level = val.m_level, Accumulator = val.m_accumulator }); } } } [HarmonyPriority(0)] [HarmonyPostfix] private static void RestoreMasteredSkills(List<SkillSnapshot> __state) { if (__state == null) { return; } for (int i = 0; i < __state.Count; i++) { SkillSnapshot skillSnapshot = __state[i]; if (skillSnapshot.Skill != null) { skillSnapshot.Skill.m_level = skillSnapshot.Level; skillSnapshot.Skill.m_accumulator = skillSnapshot.Accumulator; } } } } [HarmonyPatch(typeof(SkillsDialog), "Setup")] internal static class MasteredSkillRowsPatch { private static readonly Color PlatinumText = Color32.op_Implicit(new Color32((byte)220, (byte)230, (byte)240, byte.MaxValue)); private static readonly Color PlatinumBar = Color32.op_Implicit(new Color32((byte)190, (byte)202, (byte)216, byte.MaxValue)); [HarmonyPostfix] [HarmonyPriority(0)] private static void ApplyGoldenStyle(Player player, List<GameObject> ___m_elements) { if ((Object)(object)player == (Object)null || ___m_elements == null) { return; } List<Skill> skillList = ((Character)player).GetSkills().GetSkillList(); int num = Math.Min(skillList.Count, ___m_elements.Count); for (int i = 0; i < num; i++) { GameObject val = ___m_elements[i]; if ((Object)(object)val != (Object)null) { StyleRow(val, SkillMasteryPlugin.IsMastered(skillList[i])); } } } private static void StyleRow(GameObject row, bool mastered) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) SkillRowPalette skillRowPalette = row.GetComponent<SkillRowPalette>(); if ((Object)(object)skillRowPalette == (Object)null) { skillRowPalette = row.AddComponent<SkillRowPalette>(); skillRowPalette.Capture(row.transform); } skillRowPalette.Apply(mastered, PlatinumText); SetBarColor(row.transform, "levelbar_total", mastered); SetBarColor(row.transform, "levelbar", mastered); SetBarColor(row.transform, "currentlevel", mastered); } private static void SetBarColor(Transform row, string childName, bool mastered) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) Transform val = Utils.FindChild(row, childName, (IterativeSearchType)0); if ((Object)(object)val == (Object)null) { return; } GuiBar component = ((Component)val).GetComponent<GuiBar>(); if (!((Object)(object)component == (Object)null)) { if (mastered) { component.SetColor(PlatinumBar); } else { component.ResetColor(); } } } } public sealed class SkillRowPalette : MonoBehaviour { private TMP_Text _nameText; private TMP_Text _levelText; private TMP_Text _bonusText; private Color _nameColor; private Color _levelColor; private Color _bonusColor; private bool _captured; internal void Capture(Transform row) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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) _nameText = FindText(row, "name"); _levelText = FindText(row, "leveltext"); _bonusText = FindText(row, "bonustext"); if ((Object)(object)_nameText != (Object)null) { _nameColor = ((Graphic)_nameText).color; } if ((Object)(object)_levelText != (Object)null) { _levelColor = ((Graphic)_levelText).color; } if ((Object)(object)_bonusText != (Object)null) { _bonusColor = ((Graphic)_bonusText).color; } _captured = true; } internal void Apply(bool mastered, Color gold) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (_captured) { if ((Object)(object)_nameText != (Object)null) { ((Graphic)_nameText).color = (mastered ? gold : _nameColor); } if ((Object)(object)_levelText != (Object)null) { ((Graphic)_levelText).color = (mastered ? gold : _levelColor); } if ((Object)(object)_bonusText != (Object)null) { ((Graphic)_bonusText).color = (mastered ? gold : _bonusColor); } } } private static TMP_Text FindText(Transform row, string childName) { Transform val = Utils.FindChild(row, childName, (IterativeSearchType)0); if (!((Object)(object)val == (Object)null)) { return ((Component)val).GetComponent<TMP_Text>(); } return null; } }