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 SkillTracker v0.1.1
SkillTracker.dll
Decompiled 12 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn.Utils; using Microsoft.CodeAnalysis; using SkillTracker.Core; using SkillTracker.Tracker; 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: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("SkillTracker")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("See your skills grow: a tracker below the minimap shows each skill as you train it, with its level and progress to the next level, and the experience of every gain rises beside it.")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1+24a64b565946f840e57da0e0ccdc987af17a0352")] [assembly: AssemblyProduct("SkillTracker")] [assembly: AssemblyTitle("SkillTracker")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.1.0")] [module: UnverifiableCode] [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 SkillTracker { [BepInPlugin("javidahmed64592.skilltracker", "Skill Tracker", "0.1.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class SkillTrackerPlugin : BaseUnityPlugin { public const string PluginGUID = "javidahmed64592.skilltracker"; public const string PluginName = "Skill Tracker"; public const string PluginVersion = "0.1.1"; private Harmony _harmony; private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown TrackerConfig.Bind(((BaseUnityPlugin)this).Config); _harmony = new Harmony("javidahmed64592.skilltracker"); _harmony.PatchAll(); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } } namespace SkillTracker.Tracker { internal static class SkillGain { public static void OnRaised(Skills skills, SkillType type, float factor, float levelBefore) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (!(levelBefore < 0f) && !(levelBefore >= 100f) && !((Object)(object)skills.m_player == (Object)null) && !((Object)(object)skills.m_player != (Object)(object)Player.m_localPlayer)) { Skill skill = skills.GetSkill(type); float gained = skill.m_info.m_increseStep * factor * Game.m_skillGainRate; TrackerPanel.OnGain(skill, gained, skill.m_level > levelBefore); } } } internal sealed class TrackerPanel : MonoBehaviour { private sealed class Row { public SkillType Skill; public GameObject Root; public RectTransform Rect; public CanvasGroup Group; public TextMeshProUGUI Level; public RectTransform Fill; public float LastGain; public float FlashUntil; } private sealed class Drop { public TextMeshProUGUI Text; public RectTransform Rect; public float Start; public float StartY; } private const float RowWidth = 200f; private const float RowHeight = 34f; private const float RowGap = 4f; private const float IconSize = 28f; private const int MaxRows = 3; private static readonly Vector2 Position = new Vector2(-40f, -250f); private const float FadeTime = 1f; private const float LevelUpFlash = 2f; private const float DropLife = 1.5f; private const float DropRise = 30f; private static readonly Color PanelColor = new Color(0f, 0f, 0f, 0.45f); private static readonly Color TrackColor = new Color(0f, 0f, 0f, 0.6f); private static readonly Color BarColor = new Color(0.95f, 0.72f, 0.25f); private static readonly Color LevelUpColor = new Color(1f, 0.85f, 0.3f); private static TrackerPanel _instance; private readonly List<Row> _rows = new List<Row>(); private readonly List<Drop> _drops = new List<Drop>(); private TMP_FontAsset _font; private Material _fontMaterial; public static void Create(Hud hud) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0089: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)hud.m_rootObject == (Object)null) && !((Object)(object)hud.m_healthText == (Object)null)) { GameObject val = new GameObject("SkillTracker", new Type[1] { typeof(RectTransform) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent(hud.m_rootObject.transform, false); Vector2 val3 = (val2.pivot = Vector2.one); Vector2 anchorMin = (val2.anchorMax = val3); val2.anchorMin = anchorMin; val2.anchoredPosition = Position; val2.sizeDelta = new Vector2(200f, 34f); _instance = val.AddComponent<TrackerPanel>(); _instance._font = hud.m_healthText.font; _instance._fontMaterial = hud.m_healthText.fontSharedMaterial; } } public static void OnGain(Skill skill, float gained, bool leveledUp) { if ((Object)(object)_instance != (Object)null && TrackerConfig.ShowSkillTracker.Value) { _instance.Show(skill, gained, leveledUp); } } private void Show(Skill skill, float gained, bool leveledUp) { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) Row row = _rows.Find((Row r) => r.Skill == skill.m_info.m_skill); if (row == null) { if (_rows.Count >= 3) { RemoveRow(Oldest()); } row = CreateRow(skill); _rows.Add(row); Layout(); } row.LastGain = Time.time; row.Group.alpha = 1f; ((TMP_Text)row.Level).text = ((int)skill.m_level).ToString(CultureInfo.InvariantCulture); row.Fill.anchorMax = new Vector2((skill.m_level >= 100f) ? 1f : skill.GetLevelPercentage(), 1f); if (leveledUp) { row.FlashUntil = Time.time + 2f; } if (gained > 0f && TrackerConfig.ShowXpDrops.Value) { AddDrop(row, gained); } } private void Update() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; float value = TrackerConfig.TrackerFadeDelay.Value; for (int num = _rows.Count - 1; num >= 0; num--) { Row row = _rows[num]; float num2 = (time - row.LastGain - value) / 1f; if (num2 >= 1f) { RemoveRow(row); } else { row.Group.alpha = 1f - Mathf.Clamp01(num2); ((Graphic)row.Level).color = ((time < row.FlashUntil) ? LevelUpColor : Color.white); } } for (int num3 = _drops.Count - 1; num3 >= 0; num3--) { Drop drop = _drops[num3]; float num4 = (time - drop.Start) / 1.5f; if (num4 >= 1f) { Object.Destroy((Object)(object)((Component)drop.Text).gameObject); _drops.RemoveAt(num3); } else { drop.Rect.anchoredPosition = new Vector2(drop.Rect.anchoredPosition.x, drop.StartY + 30f * num4); ((TMP_Text)drop.Text).alpha = 1f - num4 * num4; } } } private Row Oldest() { Row row = _rows[0]; foreach (Row row2 in _rows) { if (row2.LastGain < row.LastGain) { row = row2; } } return row; } private void RemoveRow(Row row) { _rows.Remove(row); Object.Destroy((Object)(object)row.Root); Layout(); } private void Layout() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _rows.Count; i++) { _rows[i].Rect.anchoredPosition = new Vector2(0f, (float)(-i) * 38f); } } private Row CreateRow(Skill skill) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0061: 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_0064: 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) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0251: 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_0269: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Row", new Type[3] { typeof(RectTransform), typeof(CanvasGroup), typeof(Image) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent(((Component)this).transform, false); Vector2 val3 = (val2.pivot = Vector2.one); Vector2 anchorMin = (val2.anchorMax = val3); val2.anchorMin = anchorMin; val2.sizeDelta = new Vector2(200f, 34f); Image component = val.GetComponent<Image>(); ((Graphic)component).color = PanelColor; ((Graphic)component).raycastTarget = false; CanvasGroup component2 = val.GetComponent<CanvasGroup>(); component2.interactable = false; component2.blocksRaycasts = false; Image obj = CreateImage((Transform)(object)val2, "Icon", Color.white); obj.sprite = skill.m_info.m_icon; obj.preserveAspect = true; RectTransform rectTransform = ((Graphic)obj).rectTransform; ((Vector2)(ref val3))..ctor(0f, 0.5f); rectTransform.pivot = val3; anchorMin = (rectTransform.anchorMax = val3); rectTransform.anchorMin = anchorMin; rectTransform.anchoredPosition = new Vector2(3f, 0f); rectTransform.sizeDelta = new Vector2(28f, 28f); TextMeshProUGUI obj2 = CreateText((Transform)(object)val2, "Name", 15f, (TextAlignmentOptions)4097); ((TMP_Text)obj2).text = Localization.instance.Localize("$skill_" + ((object)Unsafe.As<SkillType, SkillType>(ref skill.m_info.m_skill)/*cast due to .constrained prefix*/).ToString().ToLowerInvariant()); Stretch(((TMP_Text)obj2).rectTransform, 36f, 46f, 2f, 14f); TextMeshProUGUI val6 = CreateText((Transform)(object)val2, "Level", 15f, (TextAlignmentOptions)4100); Stretch(((TMP_Text)val6).rectTransform, 154f, 6f, 2f, 14f); Image obj3 = CreateImage((Transform)(object)val2, "Track", TrackColor); Stretch(((Graphic)obj3).rectTransform, 36f, 6f, 23f, 5f); RectTransform rectTransform2 = ((Graphic)CreateImage((Transform)(object)((Graphic)obj3).rectTransform, "Fill", BarColor)).rectTransform; rectTransform2.anchorMin = Vector2.zero; rectTransform2.anchorMax = new Vector2(0f, 1f); anchorMin = (rectTransform2.offsetMax = Vector2.zero); rectTransform2.offsetMin = anchorMin; return new Row { Skill = skill.m_info.m_skill, Root = val, Rect = val2, Group = component2, Level = val6, Fill = rectTransform2 }; } private void AddDrop(Row row, float gained) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) TextMeshProUGUI val = CreateText(((Component)this).transform, "XpDrop", 16f, (TextAlignmentOptions)4100); ((TMP_Text)val).text = "+" + gained.ToString(DropFormat(gained), CultureInfo.InvariantCulture); ((Graphic)val).color = BarColor; RectTransform rectTransform = ((TMP_Text)val).rectTransform; Vector2 anchorMin = (rectTransform.anchorMax = Vector2.one); rectTransform.anchorMin = anchorMin; rectTransform.pivot = new Vector2(1f, 0.5f); rectTransform.sizeDelta = new Vector2(80f, 20f); float num = row.Rect.anchoredPosition.y - 17f; rectTransform.anchoredPosition = new Vector2(-206f, num); _drops.Add(new Drop { Text = val, Rect = rectTransform, Start = Time.time, StartY = num }); } private static string DropFormat(float gained) { if (!(gained >= 10f)) { if (gained >= 1f) { return "0.#"; } return "0.##"; } return "0"; } private TextMeshProUGUI CreateText(Transform parent, string name, float size, TextAlignmentOptions alignment) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.SetActive(false); val.transform.SetParent(parent, false); TextMeshProUGUI obj = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj).font = _font; ((TMP_Text)obj).fontSharedMaterial = _fontMaterial; val.SetActive(true); ((TMP_Text)obj).fontSize = size; ((TMP_Text)obj).alignment = alignment; ((TMP_Text)obj).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)obj).overflowMode = (TextOverflowModes)0; ((Graphic)obj).raycastTarget = false; return obj; } private static Image CreateImage(Transform parent, string name, Color color) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent(parent, false); Image component = val.GetComponent<Image>(); ((Graphic)component).color = color; ((Graphic)component).raycastTarget = false; return component; } private static void Stretch(RectTransform rect, float left, float right, float top, float height) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_004b: Unknown result type (might be due to invalid IL or missing references) rect.anchorMin = new Vector2(0f, 1f); rect.anchorMax = Vector2.one; rect.pivot = new Vector2(0.5f, 1f); rect.offsetMin = new Vector2(left, 0f - top - height); rect.offsetMax = new Vector2(0f - right, 0f - top); } } } namespace SkillTracker.Patches { [HarmonyPatch(typeof(Hud), "Awake")] internal static class Hud_Awake_TrackerPatch { private static void Postfix(Hud __instance) { TrackerPanel.Create(__instance); } } [HarmonyPatch(typeof(Skills), "RaiseSkill")] internal static class Skills_RaiseSkill_TrackerPatch { private static void Prefix(Skills __instance, SkillType skillType, out float __state) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) __state = (((int)skillType == 0) ? (-1f) : __instance.GetSkill(skillType).m_level); } private static void Postfix(Skills __instance, SkillType skillType, float factor, float __state) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) SkillGain.OnRaised(__instance, skillType, factor, __state); } } } namespace SkillTracker.Core { internal static class TrackerConfig { public static ConfigEntry<bool> ShowSkillTracker; public static ConfigEntry<bool> ShowXpDrops; public static ConfigEntry<float> TrackerFadeDelay; public static void Bind(ConfigFile config) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown ShowSkillTracker = config.Bind<bool>("General", "ShowSkillTracker", true, "Shows the skills you earn experience in below the minimap, with their level and progress towards the next level."); ShowXpDrops = config.Bind<bool>("General", "ShowXpDrops", true, "Shows the experience each gain gives, rising beside the skill tracker."); TrackerFadeDelay = config.Bind<float>("General", "FadeDelay", 6f, new ConfigDescription("Seconds a skill stays in the tracker after its last gain before fading out.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 30f), Array.Empty<object>())); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { internal IgnoresAccessChecksToAttribute(string assemblyName) { } } }