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 SkillsTracker v1.0.1
plugins/SkillsTracker.dll
Decompiled 16 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; 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.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("SkillsTracker")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+f17c9c3abca37f4305189012d218cc3da845f021")] [assembly: AssemblyProduct("SkillsTracker")] [assembly: AssemblyTitle("SkillsTracker")] [assembly: AssemblyVersion("1.0.1.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 SkillsTracker { [BepInPlugin("fr.romaindurand.skillstracker", "SkillsTracker", "1.0.1")] public sealed class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(Skill), "Raise")] private static class WatchExperience { private static void Prefix(Skill __instance, out float __state) { __state = __instance.m_accumulator; } private static void Postfix(Skill __instance, float __state, bool __result) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0075: Expected I4, but got Unknown Plugin instance = Plugin.instance; Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)instance) && instance.Automatic && Object.op_Implicit((Object)(object)localPlayer) && (__result || !(__instance.m_accumulator <= __state))) { SkillType skill = __instance.m_info.m_skill; if (SkillData.Invoke(((Character)localPlayer).GetSkills()).TryGetValue(skill, out var value) && value == __instance) { instance.SelectCharacter(localPlayer); instance.tracking.RecordGain((int)skill, Time.unscaledTimeAsDouble); } } } } [HarmonyPatch(typeof(SkillsDialog), "Setup")] private static class SetupMenu { private static void Postfix(SkillsDialog __instance, Player __0, List<GameObject> ___m_elements, ScrollRect ___skillListScrollRect, Scrollbar ___scrollbar) { Plugin instance = Plugin.instance; if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)__0) && !((Object)(object)__0 != (Object)(object)Player.m_localPlayer)) { instance.SelectCharacter(__0); SkillsMenu skillsMenu = default(SkillsMenu); if (!((Component)__instance).TryGetComponent<SkillsMenu>(ref skillsMenu)) { skillsMenu = ((Component)__instance).gameObject.AddComponent<SkillsMenu>(); } instance.menu = skillsMenu; skillsMenu.Bind(instance, __0, __instance, ((Character)__0).GetSkills().GetSkillList(), ___m_elements, ___skillListScrollRect, ___scrollbar); } } } [HarmonyPatch(typeof(Hud), "UpdateStatusEffects")] private static class UpdateHud { private static void Postfix(Hud __instance, List<RectTransform> ___m_statusEffects) { Plugin instance = Plugin.instance; Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)localPlayer) && Object.op_Implicit((Object)(object)__instance.m_statusEffectTemplate) && Object.op_Implicit((Object)(object)__instance.m_statusEffectListRoot)) { instance.SelectCharacter(localPlayer); SkillHud skillHud = default(SkillHud); if (!((Component)__instance).TryGetComponent<SkillHud>(ref skillHud)) { skillHud = ((Component)__instance).gameObject.AddComponent<SkillHud>(); } instance.hud = skillHud; skillHud.Render(__instance, SkillData.Invoke(((Character)localPlayer).GetSkills()), instance.tracking, instance.Mode, ___m_statusEffects.Count, Time.unscaledTimeAsDouble); } } } private const string Guid = "fr.romaindurand.skillstracker"; private const string Version = "1.0.1"; private const string PinsKey = "fr.romaindurand.skillstracker.pins"; private static Plugin instance; private static readonly FieldRef<Skills, Dictionary<SkillType, Skill>> SkillData = AccessTools.FieldRefAccess<Skills, Dictionary<SkillType, Skill>>("m_skillData"); private readonly Tracking tracking = new Tracking(); private Harmony harmony; private Player character; private SkillHud hud; private SkillsMenu menu; private ConfigEntry<bool> remaining; private ConfigEntry<bool> absolute; private ConfigEntry<bool> total; private ConfigEntry<bool> automatic; internal static bool French => Localization.instance.GetSelectedLanguage() == "French"; internal DisplayMode Mode => (DisplayMode)((remaining.Value ? 1 : 0) | (absolute.Value ? 2 : 0) | (total.Value ? 4 : 0)); internal bool Automatic => automatic.Value; internal bool IsPinned(SkillType skill) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected I4, but got Unknown return tracking.IsPinned((int)skill); } private void Awake() { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown remaining = ((BaseUnityPlugin)this).Config.Bind<bool>("Display", "Remaining", false, "Show XP remaining instead of XP earned."); absolute = ((BaseUnityPlugin)this).Config.Bind<bool>("Display", "Absolute", false, "Show XP values instead of percentages."); total = ((BaseUnityPlugin)this).Config.Bind<bool>("Display", "TotalToLevel100", false, "Show cumulative progress to level 100."); automatic = ((BaseUnityPlugin)this).Config.Bind<bool>("Tracking", "Automatic", false, "Show unpinned skills for five seconds after they gain XP."); automatic.SettingChanged += delegate { if (!automatic.Value) { tracking.ClearTemporary(); } }; instance = this; harmony = new Harmony("fr.romaindurand.skillstracker"); harmony.PatchAll(typeof(Plugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"SkillsTracker {((BaseUnityPlugin)this).Info.Metadata.Version} loaded ({((BaseUnityPlugin)this).Info.Metadata.GUID})."); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } instance = null; if (Object.op_Implicit((Object)(object)hud)) { Object.Destroy((Object)(object)hud); } if (Object.op_Implicit((Object)(object)menu)) { Object.Destroy((Object)(object)menu); } } private void SelectCharacter(Player player) { if (character != player) { character = player; string value = null; if (Object.op_Implicit((Object)(object)player)) { player.m_customData.TryGetValue("fr.romaindurand.skillstracker.pins", out value); } tracking.LoadPins(value); } } internal void SetPinned(Player player, SkillType skill, bool pinned) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected I4, but got Unknown if (Object.op_Implicit((Object)(object)player) && !((Object)(object)player != (Object)(object)Player.m_localPlayer)) { SelectCharacter(player); tracking.SetPinned((int)skill, pinned); character.m_customData["fr.romaindurand.skillstracker.pins"] = tracking.SavePins(); } } internal void ToggleRemaining() { remaining.Value = !remaining.Value; } internal void ToggleAbsolute() { absolute.Value = !absolute.Value; } internal void ToggleTotal() { total.Value = !total.Value; } internal void ToggleAutomatic() { automatic.Value = !automatic.Value; } } [Flags] internal enum DisplayMode { Current = 0, Remaining = 1, Absolute = 2, Total = 4 } internal readonly struct Progress { private const int MaxLevel = 100; private static readonly double[] Cumulative = BuildThresholds(); internal readonly double Current; internal readonly double Goal; private Progress(double current, double goal) { Current = current; Goal = goal; } internal static Progress Calculate(float level, float accumulator, bool total) { int num = Math.Max(0, Math.Min(100, (int)level)); int num2 = Math.Min(num, 99); double num3 = Threshold(num2); double num4 = ((num == 100) ? num3 : Math.Max(0.0, Math.Min(num3, accumulator))); if (!total) { return new Progress(num4, num3); } return new Progress(Cumulative[num2] + num4, Cumulative[100]); } internal string Format(DisplayMode mode, CultureInfo culture) { double num = (((mode & DisplayMode.Remaining) != DisplayMode.Current) ? (Goal - Current) : Current); if ((mode & DisplayMode.Absolute) == 0) { return (num / Goal * 100.0).ToString("F2", culture) + "%"; } string text = num.ToString("0.##", culture); double goal = Goal; return text + "/" + goal.ToString("0.##", culture) + " XP"; } private static float Threshold(int level) { return 0.5f * (float)Math.Pow(level + 1, 1.5) + 0.5f; } private static double[] BuildThresholds() { double[] array = new double[101]; for (int i = 0; i < 100; i++) { array[i + 1] = array[i] + (double)Threshold(i); } return array; } } internal sealed class SkillHud : MonoBehaviour { private sealed class StatusIcon { private readonly Image icon; private readonly TMP_Text name; private readonly TMP_Text progress; private SkillType type; private string language; private float level = -1f; private float accumulator; private DisplayMode mode; private float spacing; internal RectTransform Rect { get; } internal StatusIcon(Hud hud) { Rect = Object.Instantiate<RectTransform>(hud.m_statusEffectTemplate, (Transform)(object)hud.m_statusEffectListRoot); ((Object)Rect).name = "SkillsTrackerStatus"; icon = ((Component)((Transform)Rect).Find("Icon")).GetComponent<Image>(); name = ((Component)((Transform)Rect).Find("Name")).GetComponent<TMP_Text>(); progress = ((Component)((Transform)Rect).Find("TimeText")).GetComponent<TMP_Text>(); ((Component)((Transform)Rect).Find("Cooldown")).gameObject.SetActive(false); ((Component)((Transform)Rect).Find("TimeBar")).gameObject.SetActive(false); Animator[] componentsInChildren = ((Component)Rect).GetComponentsInChildren<Animator>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Behaviour)componentsInChildren[i]).enabled = false; } Graphic[] componentsInChildren2 = ((Component)Rect).GetComponentsInChildren<Graphic>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].raycastTarget = false; } SetTextSizing(name); SetTextSizing(progress); ((Component)name).gameObject.SetActive(true); ((Component)progress).gameObject.SetActive(true); } private static void SetTextSizing(TMP_Text label) { label.textWrappingMode = (TextWrappingModes)0; label.overflowMode = (TextOverflowModes)1; label.fontSizeMin = 8f; label.enableAutoSizing = true; } internal unsafe void Render(SkillType skillType, Skill skill, DisplayMode display, Vector2 position, float slotWidth, string currentLanguage) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0110: 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_00f6: Unknown result type (might be due to invalid IL or missing references) if (Rect.anchoredPosition != position) { Rect.anchoredPosition = position; } if (spacing != slotWidth) { spacing = slotWidth; name.rectTransform.SetSizeWithCurrentAnchors((Axis)0, spacing - 4f); progress.rectTransform.SetSizeWithCurrentAnchors((Axis)0, spacing - 4f); } if ((Object)(object)icon.sprite != (Object)(object)skill.m_info.m_icon) { icon.sprite = skill.m_info.m_icon; } if (((Behaviour)icon).enabled != Object.op_Implicit((Object)(object)icon.sprite)) { ((Behaviour)icon).enabled = Object.op_Implicit((Object)(object)icon.sprite); } bool num = currentLanguage != language; int num2 = (int)skill.m_level; if (num || type != skillType || (int)level != num2) { language = currentLanguage; type = skillType; string text = "skill_" + ((object)(*(SkillType*)(&skillType))/*cast due to .constrained prefix*/).ToString().ToLowerInvariant(); string text2 = Localization.instance.Localize("$" + text); string arg = ((text2 == "[" + text + "]") ? ((object)(*(SkillType*)(&skillType))/*cast due to .constrained prefix*/).ToString() : text2); name.text = $"{arg} ({num2})"; } if (num || mode != display || level != skill.m_level || accumulator != skill.m_accumulator) { mode = display; level = skill.m_level; accumulator = skill.m_accumulator; bool total = (mode & DisplayMode.Total) != 0; CultureInfo culture = ((language == "French") ? CultureInfo.GetCultureInfo("fr-FR") : CultureInfo.CurrentCulture); progress.text = Progress.Calculate(level, accumulator, total).Format(mode, culture); } if (!((Component)Rect).gameObject.activeSelf) { ((Component)Rect).gameObject.SetActive(true); } } } private const DisplayMode WideProgress = DisplayMode.Absolute | DisplayMode.Total; private readonly List<StatusIcon> icons = new List<StatusIcon>(); internal void Render(Hud hud, Dictionary<SkillType, Skill> skills, Tracking tracking, DisplayMode mode, int nativeCount, double now) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected I4, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) int num = 0; int num2 = Mathf.Max(1, hud.m_effectsPerRow); float statusEffectSpacing = hud.m_statusEffectSpacing; int num3 = (((mode & (DisplayMode.Absolute | DisplayMode.Total)) != (DisplayMode.Absolute | DisplayMode.Total) || num2 <= 1) ? 1 : 2); int num4 = nativeCount; string currentLanguage = null; foreach (KeyValuePair<SkillType, Skill> skill in skills) { if (tracking.IsVisible((int)skill.Key, now)) { if (num == 0) { currentLanguage = Localization.instance.GetSelectedLanguage(); } if (num == icons.Count) { icons.Add(new StatusIcon(hud)); } else if (!Object.op_Implicit((Object)(object)icons[num].Rect)) { icons[num] = new StatusIcon(hud); } int num5 = num4 % num2; if (num5 + num3 > num2) { num4 += num2 - num5; num5 = 0; } icons[num].Render(skill.Key, skill.Value, mode, new Vector2(-4f - ((float)num5 + (float)(num3 - 1) * 0.5f) * statusEffectSpacing, (float)(-(num4 / num2)) * statusEffectSpacing), (float)num3 * statusEffectSpacing, currentLanguage); num4 += num3; num++; } } for (int i = num; i < icons.Count; i++) { if (Object.op_Implicit((Object)(object)icons[i].Rect) && ((Component)icons[i].Rect).gameObject.activeSelf) { ((Component)icons[i].Rect).gameObject.SetActive(false); } } } private void OnDestroy() { foreach (StatusIcon icon in icons) { if (Object.op_Implicit((Object)(object)icon.Rect)) { Object.Destroy((Object)(object)((Component)icon.Rect).gameObject); } } } } internal sealed class SkillsMenu : MonoBehaviour { private sealed class SkillCheckbox { internal readonly Toggle Toggle; internal readonly GameObject Mark; internal readonly GuiBar[] Bars; internal SkillType Skill; internal SkillCheckbox(Toggle toggle, GameObject mark, GuiBar[] bars) { Toggle = toggle; Mark = mark; Bars = bars; } } private const float ToolbarHeight = 32f; private const float ToolbarSpace = 38f; private const float CheckboxGutter = 32f; private readonly Dictionary<GameObject, SkillCheckbox> checkboxes = new Dictionary<GameObject, SkillCheckbox>(); private readonly TMP_Text[] labels = (TMP_Text[])(object)new TMP_Text[4]; private Plugin plugin; private Player player; private RectTransform toolbar; private RectTransform scrollRect; private RectTransform scrollbarRect; private RectTransform listRoot; private float rowsHeight; private DisplayMode displayedMode; private bool displayedAuto; private bool displayedFrench; internal void Bind(Plugin tracker, Player localPlayer, SkillsDialog dialog, List<Skill> skills, List<GameObject> rows, ScrollRect scroll, Scrollbar scrollbar) { //IL_009b: 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_00ac: Unknown result type (might be due to invalid IL or missing references) plugin = tracker; player = localPlayer; if (!Object.op_Implicit((Object)(object)toolbar)) { CreateToolbar(dialog, scroll, scrollbar); } int num = Math.Min(skills.Count, rows.Count); listRoot = dialog.m_listRoot; rowsHeight = (float)num * dialog.m_spacing; FitListHeight(); for (int i = 0; i < num; i++) { GameObject val = rows[i]; if (!checkboxes.TryGetValue(val, out var value)) { value = CreateCheckbox(val); checkboxes.Add(val, value); } value.Skill = skills[i].m_info.m_skill; bool flag = plugin.IsPinned(value.Skill); value.Toggle.SetIsOnWithoutNotify(flag); value.Mark.SetActive(flag); } RefreshLabels(); } private void Update() { if (Object.op_Implicit((Object)(object)toolbar) && Object.op_Implicit((Object)(object)plugin) && (displayedMode != plugin.Mode || displayedAuto != plugin.Automatic || displayedFrench != Plugin.French)) { RefreshLabels(); } } private void CreateToolbar(SkillsDialog dialog, ScrollRect scroll, Scrollbar scrollbar) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0050: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Expected O, but got Unknown //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Expected O, but got Unknown //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) scrollRect = (RectTransform)((Component)scroll).transform; toolbar = NewRect("SkillsTrackerOptions", ((Transform)scrollRect).parent); ((Transform)toolbar).SetSiblingIndex(((Transform)scrollRect).GetSiblingIndex() + 1); toolbar.anchorMin = new Vector2(scrollRect.anchorMin.x, scrollRect.anchorMax.y); toolbar.anchorMax = scrollRect.anchorMax; toolbar.offsetMax = scrollRect.offsetMax - new Vector2(0f, 2f); toolbar.offsetMin = new Vector2(scrollRect.offsetMin.x, toolbar.offsetMax.y - 32f); RectTransform obj = scrollRect; obj.offsetMax -= new Vector2(0f, 38f); if (Object.op_Implicit((Object)(object)scrollbar) && !((Component)scrollbar).transform.IsChildOf((Transform)(object)scrollRect)) { scrollbarRect = (RectTransform)((Component)scrollbar).transform; RectTransform obj2 = scrollbarRect; obj2.offsetMax -= new Vector2(0f, 38f); } Button nativeButton = Array.Find(((Component)dialog).GetComponentsInChildren<Button>(true), (Button button) => Object.op_Implicit((Object)(object)((Selectable)button).image) && Object.op_Implicit((Object)(object)((Selectable)button).image.sprite) && !((Component)button).transform.IsChildOf((Transform)(object)scrollRect) && Object.op_Implicit((Object)(object)((Component)button).GetComponentInChildren<TMP_Text>(true))); AddButton(0, nativeButton, dialog.m_totalSkillText, new UnityAction(plugin.ToggleRemaining)); AddButton(1, nativeButton, dialog.m_totalSkillText, new UnityAction(plugin.ToggleAbsolute)); AddButton(2, nativeButton, dialog.m_totalSkillText, new UnityAction(plugin.ToggleTotal)); AddButton(3, nativeButton, dialog.m_totalSkillText, new UnityAction(plugin.ToggleAutomatic)); } private void AddButton(int index, Button nativeButton, TMP_Text nativeLabel, UnityAction click) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0130: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_00f3: Invalid comparison between Unknown and I4 //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) RectTransform val = NewRect("SkillsTrackerOption" + index, (Transform)(object)toolbar); val.anchorMin = new Vector2((float)index / 4f, 0f); val.anchorMax = new Vector2((float)(index + 1) / 4f, 1f); val.offsetMin = new Vector2(2f, 0f); val.offsetMax = new Vector2(-2f, 0f); Image val2 = ((Component)val).gameObject.AddComponent<Image>(); Button val3 = ((Component)val).gameObject.AddComponent<Button>(); ((Selectable)val3).targetGraphic = (Graphic)(object)val2; if (Object.op_Implicit((Object)(object)nativeButton)) { val2.sprite = ((Selectable)nativeButton).image.sprite; val2.type = ((Selectable)nativeButton).image.type; ((Graphic)val2).color = ((Graphic)((Selectable)nativeButton).image).color; ((Selectable)val3).colors = ((Selectable)nativeButton).colors; ((Selectable)val3).spriteState = ((Selectable)nativeButton).spriteState; ((Selectable)val3).transition = (Transition)(((int)((Selectable)nativeButton).transition == 3) ? 1 : ((int)((Selectable)nativeButton).transition)); TMP_Text componentInChildren = ((Component)nativeButton).GetComponentInChildren<TMP_Text>(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { nativeLabel = componentInChildren; } } else { ((Graphic)val2).color = new Color(0.25f, 0.2f, 0.14f, 0.95f); } RectTransform obj = NewRect("Label", (Transform)(object)val); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; obj.offsetMin = new Vector2(4f, 1f); obj.offsetMax = new Vector2(-4f, -1f); TextMeshProUGUI val4 = ((Component)obj).gameObject.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val4).font = nativeLabel.font; ((TMP_Text)val4).fontSharedMaterial = nativeLabel.fontSharedMaterial; ((TMP_Text)val4).fontStyle = nativeLabel.fontStyle; ((TMP_Text)val4).fontWeight = nativeLabel.fontWeight; ((Graphic)val4).color = ((Graphic)nativeLabel).color; ((TMP_Text)val4).fontSize = 17f; ((TMP_Text)val4).fontSizeMax = 17f; ((TMP_Text)val4).fontSizeMin = 10f; ((TMP_Text)val4).enableAutoSizing = true; ((TMP_Text)val4).alignment = (TextAlignmentOptions)514; ((TMP_Text)val4).textWrappingMode = (TextWrappingModes)0; ((Graphic)val4).raycastTarget = false; labels[index] = (TMP_Text)(object)val4; ((UnityEvent)val3.onClick).AddListener(click); ((UnityEvent)val3.onClick).AddListener(new UnityAction(RefreshLabels)); } private void RefreshLabels() { displayedMode = plugin.Mode; displayedAuto = plugin.Automatic; displayedFrench = Plugin.French; labels[0].text = (((displayedMode & DisplayMode.Remaining) != DisplayMode.Current) ? Translate("XP restante", "XP remaining") : Translate("XP acquise", "XP earned")); labels[1].text = (((displayedMode & DisplayMode.Absolute) != DisplayMode.Current) ? Translate("XP absolue", "Absolute XP") : Translate("Pourcentage", "Percentage")); labels[2].text = (((displayedMode & DisplayMode.Total) != DisplayMode.Current) ? Translate("Niveau 100", "Level 100") : Translate("Niveau suivant", "Next level")); labels[3].text = (displayedAuto ? Translate("Auto activé", "Auto on") : Translate("Auto désactivé", "Auto off")); } private string Translate(string french, string english) { if (!displayedFrench) { return english; } return french; } private SkillCheckbox CreateCheckbox(GameObject row) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) RectTransform parent = (RectTransform)row.transform; GuiBar[] componentsInChildren = row.GetComponentsInChildren<GuiBar>(); ResizeBars(componentsInChildren, -32f); RectTransform val = NewRect("SkillsTrackerCheckbox", (Transform)(object)parent); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(1f, 0.5f); val.anchorMax = val2; val.anchorMin = val2; val.anchoredPosition = new Vector2(-16f, 0f); val.sizeDelta = new Vector2(26f, 26f); Image val3 = ((Component)val).gameObject.AddComponent<Image>(); ((Graphic)val3).color = new Color(0.76f, 0.63f, 0.43f); MakeBox("Background", val, new Vector2(22f, 22f), new Color(0.11f, 0.08f, 0.06f)); RectTransform val4 = NewRect("Checkmark", (Transform)(object)val); val4.sizeDelta = new Vector2(17f, 17f); Color color = default(Color); ((Color)(ref color))..ctor(1f, 0.84f, 0.49f); Image obj = MakeBox("ShortStroke", val4, new Vector2(7f, 3f), color); ((Graphic)obj).rectTransform.anchoredPosition = new Vector2(-4f, -1f); ((Transform)((Graphic)obj).rectTransform).localRotation = Quaternion.Euler(0f, 0f, -45f); Image obj2 = MakeBox("LongStroke", val4, new Vector2(13f, 3f), color); ((Graphic)obj2).rectTransform.anchoredPosition = new Vector2(2.5f, 1f); ((Transform)((Graphic)obj2).rectTransform).localRotation = Quaternion.Euler(0f, 0f, 45f); Toggle val5 = ((Component)val).gameObject.AddComponent<Toggle>(); ((Selectable)val5).targetGraphic = (Graphic)(object)val3; SkillCheckbox checkbox = new SkillCheckbox(val5, ((Component)val4).gameObject, componentsInChildren); ((UnityEvent<bool>)(object)val5.onValueChanged).AddListener((UnityAction<bool>)delegate(bool value) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) checkbox.Mark.SetActive(value); plugin.SetPinned(player, checkbox.Skill, value); }); return checkbox; } private static void ResizeBars(GuiBar[] bars, float widthChange) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) foreach (GuiBar val in bars) { if (Object.op_Implicit((Object)(object)val)) { RectTransform val2 = (RectTransform)((Component)val).transform; val2.offsetMax += new Vector2(widthChange, 0f); Rect rect = val2.rect; val.SetWidth(((Rect)(ref rect)).width); } } } private static Image MakeBox(string name, RectTransform parent, Vector2 size, Color color) { //IL_0008: 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) RectTransform obj = NewRect(name, (Transform)(object)parent); obj.sizeDelta = size; Image obj2 = ((Component)obj).gameObject.AddComponent<Image>(); ((Graphic)obj2).color = color; ((Graphic)obj2).raycastTarget = false; return obj2; } private static RectTransform NewRect(string name, Transform parent) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown RectTransform val = (RectTransform)new GameObject(name, new Type[1] { typeof(RectTransform) }).transform; ((Transform)val).SetParent(parent, false); return val; } private void FitListHeight() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = listRoot; Rect rect = scrollRect.rect; obj.SetSizeWithCurrentAnchors((Axis)1, Mathf.Max(((Rect)(ref rect)).height, rowsHeight)); } private void OnDestroy() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)toolbar)) { Object.Destroy((Object)(object)((Component)toolbar).gameObject); } if (Object.op_Implicit((Object)(object)scrollRect)) { RectTransform obj = scrollRect; obj.offsetMax += new Vector2(0f, 38f); if (Object.op_Implicit((Object)(object)listRoot)) { FitListHeight(); } } if (Object.op_Implicit((Object)(object)scrollbarRect)) { RectTransform obj2 = scrollbarRect; obj2.offsetMax += new Vector2(0f, 38f); } foreach (SkillCheckbox value in checkboxes.Values) { ResizeBars(value.Bars, 32f); if (Object.op_Implicit((Object)(object)value.Toggle)) { Object.Destroy((Object)(object)((Component)value.Toggle).gameObject); } } } } internal sealed class Tracking { private const double DisplaySeconds = 5.0; private readonly HashSet<int> pins = new HashSet<int>(); private readonly Dictionary<int, double> deadlines = new Dictionary<int, double>(); internal bool IsPinned(int skill) { return pins.Contains(skill); } internal void SetPinned(int skill, bool pinned) { if (pinned) { pins.Add(skill); deadlines.Remove(skill); } else { pins.Remove(skill); } } internal void RecordGain(int skill, double now) { if (!IsPinned(skill)) { deadlines[skill] = now + 5.0; } } internal bool IsVisible(int skill, double now) { if (IsPinned(skill)) { return true; } if (!deadlines.TryGetValue(skill, out var value)) { return false; } if (now < value) { return true; } deadlines.Remove(skill); return false; } internal void ClearTemporary() { deadlines.Clear(); } internal void LoadPins(string saved) { pins.Clear(); ClearTemporary(); if (string.IsNullOrEmpty(saved)) { return; } string[] array = saved.Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { if (int.TryParse(array[i], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { pins.Add(result); } } } internal string SavePins() { return string.Join(",", from skill in pins orderby skill select skill.ToString(CultureInfo.InvariantCulture)); } } }