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 UpgradeListFix v1.0.0
UpgradeListFix.dll
Decompiled an hour agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyVersion("0.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 UpgradeListFix { [BepInPlugin("rev.upgradelistfix", "UpgradeListFix", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string Guid = "rev.upgradelistfix"; public const string Name = "UpgradeListFix"; public const string Version = "1.0.0"; internal static ManualLogSource Log; internal static ConfigEntry<bool> Debug; private void Awake() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Debug = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Debug", false, "Write the measured line metrics of the upgrade list into the log."); new Harmony("rev.upgradelistfix").PatchAll(typeof(Patches)); Log.LogInfo((object)"UpgradeListFix 1.0.0 loaded"); } } internal static class Patches { private static readonly FieldRef<StatsUI, TextMeshProUGUI> NamesRef = AccessTools.FieldRefAccess<StatsUI, TextMeshProUGUI>("Text"); private static readonly FieldRef<StatsUI, TextMeshProUGUI> NumbersRef = AccessTools.FieldRefAccess<StatsUI, TextMeshProUGUI>("textNumbers"); private static string alignedFor; [HarmonyPatch(typeof(StatsUI), "Fetch")] [HarmonyPostfix] private static void Align(StatsUI __instance) { TextMeshProUGUI val = NamesRef.Invoke(__instance); TextMeshProUGUI val2 = NumbersRef.Invoke(__instance); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || string.IsNullOrEmpty(((TMP_Text)val).text) || string.IsNullOrEmpty(((TMP_Text)val2).text) || ((TMP_Text)val).text == alignedFor) { return; } ((TMP_Text)val).ForceMeshUpdate(false, false); ((TMP_Text)val2).ForceMeshUpdate(false, false); if (((TMP_Text)val).textInfo.lineCount < 2 || ((TMP_Text)val2).textInfo.lineCount < 2) { return; } float num = ((TMP_Text)val).textInfo.lineInfo[0].baseline - ((TMP_Text)val).textInfo.lineInfo[1].baseline; float num2 = ((TMP_Text)val2).textInfo.lineInfo[0].baseline - ((TMP_Text)val2).textInfo.lineInfo[1].baseline; float num3 = num - num2; alignedFor = ((TMP_Text)val).text; if (!(Mathf.Abs(num3) < 0.05f)) { float num4 = Mathf.Max(1f, ((TMP_Text)val2).fontSize); ((TMP_Text)val2).lineSpacing = ((TMP_Text)val2).lineSpacing + num3 * 100f / num4; ((TMP_Text)val2).ForceMeshUpdate(false, false); if (Plugin.Debug.Value) { Plugin.Log.LogInfo((object)$"names pitch {num:0.##}, numbers pitch {num2:0.##}, line spacing set to {((TMP_Text)val2).lineSpacing:0.##}"); } } } } }