Decompiled source of CustomRankLetterColorizer v2.1.0
CustomRankLetterColorizer.dll
Decompiled 3 hours ago
The result has been truncated due to the large size, download it to view full contents!
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.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using HarmonyLib; using PluginConfig.API; using PluginConfig.API.Decorators; using PluginConfig.API.Fields; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CustomRankLetterColorizer")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CustomRankLetterColorizer")] [assembly: AssemblyTitle("CustomRankLetterColorizer")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace CustomRankLetterColorizer; [BepInPlugin("ali.uk.customrankcolor", "Custom Rank Letter Colorizer", "2.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class CustomRankLetterColorizerPlugin : BaseUnityPlugin { public static ManualLogSource Log; public Color DColor = HexToColor("0094FF"); public Color CColor = HexToColor("4CFF00"); public Color BColor = HexToColor("FFD800"); public Color AColor = HexToColor("FF6A00"); public Color SColor = HexToColor("FF0000"); public Color PColor = HexToColor("FFFFFF"); public Color GoldBorderColor = HexToColor("FFB100"); public Color DBorderColor = Color.black; public Color CBorderColor = Color.black; public Color BBorderColor = Color.black; public Color ABorderColor = Color.black; public Color SBorderColor = Color.black; public Color PBorderColor = HexToColor("FFB100"); public string DText = "D"; public string CText = "C"; public string BText = "B"; public string AText = "A"; public string SText = "S"; public string PText = "P"; public bool DHasBorder = false; public bool CHasBorder = false; public bool BHasBorder = false; public bool AHasBorder = false; public bool SHasBorder = false; public bool PHasBorder = true; public bool BLSUsesBorderColor = true; public Color MajorAssistsBackgroundColor = HexToColor("4D99E6"); public Color MajorAssistsTextColor = HexToColor("FFFFFF"); public Color CheatsBorderColor = HexToColor("40FF40"); public Color CheatsTextColor = HexToColor("FFFFFF"); public string CheatsText = "_"; public bool GammaAdjustment = false; public bool SpacesToNewlinesInLevelStats = true; internal bool BLSLoaded; private PluginConfigurator config; public static CustomRankLetterColorizerPlugin Instance { get; private set; } private void Awake() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Expected O, but got Unknown //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Expected O, but got Unknown //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Expected O, but got Unknown //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Expected O, but got Unknown //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Expected O, but got Unknown //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Expected O, but got Unknown //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Expected O, but got Unknown //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Expected O, but got Unknown //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Expected O, but got Unknown //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Expected O, but got Unknown //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Expected O, but got Unknown //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Expected O, but got Unknown //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Expected O, but got Unknown //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Expected O, but got Unknown //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Expected O, but got Unknown //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Expected O, but got Unknown //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Expected O, but got Unknown //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Expected O, but got Unknown //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Expected O, but got Unknown //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Expected O, but got Unknown //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Expected O, but got Unknown //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Expected O, but got Unknown //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Expected O, but got Unknown //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Expected O, but got Unknown //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Expected O, but got Unknown //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Expected O, but got Unknown //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Expected O, but got Unknown //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Expected O, but got Unknown //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Expected O, but got Unknown //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Expected O, but got Unknown //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Expected O, but got Unknown //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Expected O, but got Unknown //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Expected O, but got Unknown //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Expected O, but got Unknown //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Expected O, but got Unknown //IL_05d2: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Expected O, but got Unknown //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Expected O, but got Unknown //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_05fe: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Expected O, but got Unknown //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Expected O, but got Unknown //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_064c: Expected O, but got Unknown //IL_0662: Unknown result type (might be due to invalid IL or missing references) //IL_066c: Expected O, but got Unknown //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_067f: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Expected O, but got Unknown //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_068e: Unknown result type (might be due to invalid IL or missing references) //IL_069c: Unknown result type (might be due to invalid IL or missing references) //IL_06a6: Expected O, but got Unknown //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Expected O, but got Unknown //IL_06d6: Unknown result type (might be due to invalid IL or missing references) //IL_06e0: Expected O, but got Unknown //IL_06ee: Unknown result type (might be due to invalid IL or missing references) //IL_06f3: Unknown result type (might be due to invalid IL or missing references) //IL_06fa: Expected O, but got Unknown //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_0702: Unknown result type (might be due to invalid IL or missing references) //IL_0710: Unknown result type (might be due to invalid IL or missing references) //IL_071a: Expected O, but got Unknown //IL_072d: Unknown result type (might be due to invalid IL or missing references) //IL_0734: Expected O, but got Unknown //IL_074a: Unknown result type (might be due to invalid IL or missing references) //IL_0754: Expected O, but got Unknown //IL_076a: Unknown result type (might be due to invalid IL or missing references) //IL_0771: Expected O, but got Unknown //IL_077a: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Unknown result type (might be due to invalid IL or missing references) //IL_0799: Expected O, but got Unknown //IL_07af: Unknown result type (might be due to invalid IL or missing references) //IL_07b9: Expected O, but got Unknown //IL_07c7: Unknown result type (might be due to invalid IL or missing references) //IL_07cc: Unknown result type (might be due to invalid IL or missing references) //IL_07d3: Expected O, but got Unknown //IL_07d6: Unknown result type (might be due to invalid IL or missing references) //IL_07db: Unknown result type (might be due to invalid IL or missing references) //IL_07e9: Unknown result type (might be due to invalid IL or missing references) //IL_07f3: Expected O, but got Unknown //IL_0801: Unknown result type (might be due to invalid IL or missing references) //IL_0806: Unknown result type (might be due to invalid IL or missing references) //IL_080d: Expected O, but got Unknown //IL_0810: Unknown result type (might be due to invalid IL or missing references) //IL_0815: Unknown result type (might be due to invalid IL or missing references) //IL_0823: Unknown result type (might be due to invalid IL or missing references) //IL_082d: Expected O, but got Unknown //IL_0844: Unknown result type (might be due to invalid IL or missing references) //IL_0849: Unknown result type (might be due to invalid IL or missing references) //IL_0850: Expected O, but got Unknown //IL_0853: Unknown result type (might be due to invalid IL or missing references) //IL_0858: Unknown result type (might be due to invalid IL or missing references) //IL_0866: Unknown result type (might be due to invalid IL or missing references) //IL_0870: Expected O, but got Unknown //IL_0887: Unknown result type (might be due to invalid IL or missing references) //IL_088c: Unknown result type (might be due to invalid IL or missing references) //IL_0893: Expected O, but got Unknown //IL_0896: Unknown result type (might be due to invalid IL or missing references) //IL_089b: Unknown result type (might be due to invalid IL or missing references) //IL_08a9: Unknown result type (might be due to invalid IL or missing references) //IL_08b3: Expected O, but got Unknown //IL_08ca: Unknown result type (might be due to invalid IL or missing references) //IL_08cf: Unknown result type (might be due to invalid IL or missing references) //IL_08d6: Expected O, but got Unknown //IL_08d9: Unknown result type (might be due to invalid IL or missing references) //IL_08de: Unknown result type (might be due to invalid IL or missing references) //IL_08ec: Unknown result type (might be due to invalid IL or missing references) //IL_08f6: Expected O, but got Unknown //IL_0912: Unknown result type (might be due to invalid IL or missing references) //IL_0919: Expected O, but got Unknown //IL_092f: Unknown result type (might be due to invalid IL or missing references) //IL_0939: Expected O, but got Unknown //IL_0955: Unknown result type (might be due to invalid IL or missing references) //IL_095c: Expected O, but got Unknown //IL_0972: Unknown result type (might be due to invalid IL or missing references) //IL_097c: Expected O, but got Unknown //IL_0989: Unknown result type (might be due to invalid IL or missing references) //IL_0990: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) Instance = this; Log = ((BaseUnityPlugin)this).Logger; config = PluginConfigurator.Create("Rank Colorizer", "ali.uk.customrankcolor"); BLSLoaded = Chainloader.PluginInfos.ContainsKey("trpg.betterlevelstats"); try { Texture2D val = new Texture2D(2, 2); using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("CustomRankLetterColorizer.iconofalltime.png"); if (stream != null) { byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); ImageConversion.LoadImage(val, array); config.image = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } else { Log.LogWarning((object)"Made a fuck up whoops"); } } catch (Exception) { } new ConfigHeader(config.rootPanel, "Change rank letters & borders", 24); ConfigPanel val2 = new ConfigPanel(config.rootPanel, "D Rank Settings", "panel_D"); StringField val3 = new StringField(val2, "Letter Text", "text_D", DText); DText = val3.value; val3.onValueChange += (StringValueChangeEventDelegate)delegate(StringValueChangeEvent e) { DText = e.value; UIRefresh.RefreshAll(); }; ColorField val4 = new ColorField(val2, "Letter Color", "color_D", DColor); DColor = val4.value; val4.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) DColor = e.value; UpdateRankColorCache(); UIRefresh.RefreshAll(); }; BoolField val5 = new BoolField(val2, "Show Border", "border_D", DHasBorder); DHasBorder = val5.value; val5.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e) { DHasBorder = e.value; UIRefresh.RefreshAll(); }; ColorField val6 = new ColorField(val2, "Border Color", "bordercolor_D", DBorderColor); DBorderColor = val6.value; val6.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) DBorderColor = e.value; UIRefresh.RefreshAll(); }; ConfigPanel val7 = new ConfigPanel(config.rootPanel, "C Rank Settings", "panel_C"); StringField val8 = new StringField(val7, "Letter Text", "text_C", CText); CText = val8.value; val8.onValueChange += (StringValueChangeEventDelegate)delegate(StringValueChangeEvent e) { CText = e.value; UIRefresh.RefreshAll(); }; ColorField val9 = new ColorField(val7, "Letter Color", "color_C", CColor); CColor = val9.value; val9.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) CColor = e.value; UpdateRankColorCache(); UIRefresh.RefreshAll(); }; BoolField val10 = new BoolField(val7, "Show Border", "border_C", CHasBorder); CHasBorder = val10.value; val10.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e) { CHasBorder = e.value; UIRefresh.RefreshAll(); }; ColorField val11 = new ColorField(val7, "Border Color", "bordercolor_C", CBorderColor); CBorderColor = val11.value; val11.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) CBorderColor = e.value; UIRefresh.RefreshAll(); }; ConfigPanel val12 = new ConfigPanel(config.rootPanel, "B Rank Settings", "panel_B"); StringField val13 = new StringField(val12, "Letter Text", "text_B", BText); BText = val13.value; val13.onValueChange += (StringValueChangeEventDelegate)delegate(StringValueChangeEvent e) { BText = e.value; UIRefresh.RefreshAll(); }; ColorField val14 = new ColorField(val12, "Letter Color", "color_B", BColor); BColor = val14.value; val14.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) BColor = e.value; UpdateRankColorCache(); UIRefresh.RefreshAll(); }; BoolField val15 = new BoolField(val12, "Show Border", "border_B", BHasBorder); BHasBorder = val15.value; val15.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e) { BHasBorder = e.value; UIRefresh.RefreshAll(); }; ColorField val16 = new ColorField(val12, "Border Color", "bordercolor_B", BBorderColor); BBorderColor = val16.value; val16.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) BBorderColor = e.value; UIRefresh.RefreshAll(); }; ConfigPanel val17 = new ConfigPanel(config.rootPanel, "A Rank Settings", "panel_A"); StringField val18 = new StringField(val17, "Letter Text", "text_A", AText); AText = val18.value; val18.onValueChange += (StringValueChangeEventDelegate)delegate(StringValueChangeEvent e) { AText = e.value; UIRefresh.RefreshAll(); }; ColorField val19 = new ColorField(val17, "Letter Color", "color_A", AColor); AColor = val19.value; val19.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) AColor = e.value; UpdateRankColorCache(); UIRefresh.RefreshAll(); }; BoolField val20 = new BoolField(val17, "Show Border", "border_A", AHasBorder); AHasBorder = val20.value; val20.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e) { AHasBorder = e.value; UIRefresh.RefreshAll(); }; ColorField val21 = new ColorField(val17, "Border Color", "bordercolor_A", ABorderColor); ABorderColor = val21.value; val21.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) ABorderColor = e.value; UIRefresh.RefreshAll(); }; ConfigPanel val22 = new ConfigPanel(config.rootPanel, "S Rank Settings", "panel_S"); StringField val23 = new StringField(val22, "Letter Text", "text_S", SText); SText = val23.value; val23.onValueChange += (StringValueChangeEventDelegate)delegate(StringValueChangeEvent e) { SText = e.value; UIRefresh.RefreshAll(); }; ColorField val24 = new ColorField(val22, "Letter Color", "color_S", SColor); SColor = val24.value; val24.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) SColor = e.value; UpdateRankColorCache(); UIRefresh.RefreshAll(); }; BoolField val25 = new BoolField(val22, "Show Border", "border_S", SHasBorder); SHasBorder = val25.value; val25.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e) { SHasBorder = e.value; UIRefresh.RefreshAll(); }; ColorField val26 = new ColorField(val22, "Border Color", "bordercolor_S", SBorderColor); SBorderColor = val26.value; val26.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) SBorderColor = e.value; UIRefresh.RefreshAll(); }; ConfigPanel val27 = new ConfigPanel(config.rootPanel, "P Rank Settings", "panel_P"); StringField val28 = new StringField(val27, "Letter Text", "text_P", PText); PText = val28.value; val28.onValueChange += (StringValueChangeEventDelegate)delegate(StringValueChangeEvent e) { PText = e.value; UIRefresh.RefreshAll(); }; ColorField val29 = new ColorField(val27, "Letter Color", "color_P", PColor); PColor = val29.value; val29.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) PColor = e.value; UpdateRankColorCache(); UIRefresh.RefreshAll(); }; BoolField val30 = new BoolField(val27, "Show Border", "border_P", PHasBorder); PHasBorder = val30.value; val30.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e) { PHasBorder = e.value; UIRefresh.RefreshAll(); }; ColorField val31 = new ColorField(val27, "Border Color", "bordercolor_P", PBorderColor); PBorderColor = val31.value; val31.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) PBorderColor = e.value; UIRefresh.RefreshAll(); }; BoolField val32 = new BoolField(val27, "BetterLevelStats Uses Border Color", "bls_border", BLSUsesBorderColor); BLSUsesBorderColor = val32.value; val32.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e) { BLSUsesBorderColor = e.value; UIRefresh.RefreshAll(); }; ConfigPanel val33 = new ConfigPanel(config.rootPanel, "Cheats Rank Settings", "panel_cheats"); new ConfigHeader(val33, "Border is always enabled (total rank only)", 24); StringField val34 = new StringField(val33, "Letter Text", "text_cheats", CheatsText); CheatsText = val34.value; val34.onValueChange += (StringValueChangeEventDelegate)delegate(StringValueChangeEvent e) { CheatsText = e.value; UIRefresh.RefreshAll(); }; ColorField val35 = new ColorField(val33, "Text Color", "textcolor_cheats", CheatsTextColor); CheatsTextColor = val35.value; val35.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) CheatsTextColor = e.value; UIRefresh.RefreshAll(); }; ColorField val36 = new ColorField(val33, "Border Color", "bordercolor_cheats", CheatsBorderColor); CheatsBorderColor = val36.value; val36.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) CheatsBorderColor = e.value; UIRefresh.RefreshAll(); }; ColorField val37 = new ColorField(config.rootPanel, "Gold Color", "color_border", GoldBorderColor); GoldBorderColor = val37.value; val37.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) GoldBorderColor = e.value; UIRefresh.RefreshAll(); }; ColorField val38 = new ColorField(config.rootPanel, "Major Assists Background Color", "color_ma_bg", MajorAssistsBackgroundColor); MajorAssistsBackgroundColor = val38.value; val38.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) MajorAssistsBackgroundColor = e.value; UIRefresh.RefreshAll(); }; ColorField val39 = new ColorField(config.rootPanel, "Major Assists Text Color", "color_ma_text", MajorAssistsTextColor); MajorAssistsTextColor = val39.value; val39.onValueChange += (ColorValueChangeEventDelegate)delegate(ColorValueChangeEvent e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) MajorAssistsTextColor = e.value; UIRefresh.RefreshAll(); }; BoolField val40 = new BoolField(config.rootPanel, "Gamma Adjustment", "gamma_adjustment", GammaAdjustment); GammaAdjustment = val40.value; val40.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e) { GammaAdjustment = e.value; UIRefresh.RefreshAll(); }; BoolField val41 = new BoolField(config.rootPanel, "Spaces to Newlines in Level Stats", "spaces_to_newlines_ls", SpacesToNewlinesInLevelStats); SpacesToNewlinesInLevelStats = val41.value; val41.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e) { SpacesToNewlinesInLevelStats = e.value; UIRefresh.RefreshAll(); }; UpdateRankColorCache(); Harmony val42 = new Harmony("ali.uk.customrankcolor"); val42.PatchAll(); PrefsManager.onPrefChanged = (Action<string, object>)Delegate.Combine(PrefsManager.onPrefChanged, new Action<string, object>(OnPrefChanged)); Log.LogInfo((object)"Enjoy ur ranks :3"); } private static Color HexToColor(string hex) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0023: Unknown result type (might be due to invalid IL or missing references) Color result = default(Color); if (ColorUtility.TryParseHtmlString("#" + hex, ref result)) { return result; } return Color.white; } private void UpdateRankColorCache() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) //IL_003e: Unknown result type (might be due to invalid IL or missing references) RankColors.D = DColor; RankColors.C = CColor; RankColors.B = BColor; RankColors.A = AColor; RankColors.S = SColor; RankColors.P = PColor; RankColors.InvalidateHexCache(); } private void OnPrefChanged(string key, object value) { if (key == "gamma") { UIRefresh.RefreshAll(); } } } public static class UIRefresh { private static readonly Dictionary<Object, Action> _actions = new Dictionary<Object, Action>(); public static void Register(Object key, Action action) { if (!(key == (Object)null)) { _actions[key] = action; } } public static void RefreshAll() { List<Object> list = new List<Object>(); foreach (KeyValuePair<Object, Action> action in _actions) { if (action.Key == (Object)null) { list.Add(action.Key); continue; } try { action.Value?.Invoke(); } catch (Exception ex) { ManualLogSource log = CustomRankLetterColorizerPlugin.Log; if (log != null) { log.LogWarning((object)("UIRefresh action threw: " + ex.Message)); } } } foreach (Object item in list) { _actions.Remove(item); } } public static void Unregister(Object key) { if (key != (Object)null) { _actions.Remove(key); } } public static void Clear() { _actions.Clear(); } } public static class RankColors { public static Color D = (Color)(((??)CustomRankLetterColorizerPlugin.Instance?.DColor) ?? new Color(0f, 0.5843f, 1f)); public static Color C = (Color)(((??)CustomRankLetterColorizerPlugin.Instance?.CColor) ?? new Color(0.298f, 1f, 0f)); public static Color B = (Color)(((??)CustomRankLetterColorizerPlugin.Instance?.BColor) ?? new Color(1f, 0.847f, 0f)); public static Color A = (Color)(((??)CustomRankLetterColorizerPlugin.Instance?.AColor) ?? new Color(1f, 0.415f, 0f)); public static Color S = (Color)(((??)CustomRankLetterColorizerPlugin.Instance?.SColor) ?? new Color(1f, 0f, 0f)); public static Color P = (Color)(((??)CustomRankLetterColorizerPlugin.Instance?.PColor) ?? new Color(1f, 1f, 1f)); private static readonly Dictionary<string, string> _hexCache = new Dictionary<string, string>(); public static readonly Dictionary<string, string> VanillaHexToRank = new Dictionary<string, string> { { "0094FF", "D" }, { "4CFF00", "C" }, { "FFD800", "B" }, { "FF6A00", "A" }, { "FF0000", "S" } }; public static void InvalidateHexCache() { _hexCache.Clear(); } public static Color ApplyGammaCorrection(Color color, bool isFinalRank = false) { //IL_0022: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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) CustomRankLetterColorizerPlugin instance = CustomRankLetterColorizerPlugin.Instance; if ((Object)(object)instance == (Object)null || !instance.GammaAdjustment) { return color; } if (!isFinalRank) { return color; } PrefsManager instance2 = MonoSingleton<PrefsManager>.Instance; float num = ((instance2 != null) ? instance2.GetFloat("gamma", 1f) : 1f); if (Mathf.Approximately(num, 1f)) { return color; } float num2 = 2f - num; if (num2 < 0.01f) { return color; } float num3 = 1f / num2; return new Color(Mathf.Clamp01(Mathf.Pow(color.r, num3)), Mathf.Clamp01(Mathf.Pow(color.g, num3)), Mathf.Clamp01(Mathf.Pow(color.b, num3)), color.a); } public static Color GetColor(string rank) { //IL_0055: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_0095: 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_0072: 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_007a: 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_0082: 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 (1 == 0) { } Color result = (Color)(rank switch { "D" => D, "C" => C, "B" => B, "A" => A, "S" => S, "P" => P, _ => Color.white, }); if (1 == 0) { } return result; } public static string GetHexColor(string rank) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (!_hexCache.TryGetValue(rank, out var value)) { value = ColorUtility.ToHtmlStringRGB(GetColor(rank)); _hexCache[rank] = value; } return value; } public static string GetText(string rank) { CustomRankLetterColorizerPlugin instance = CustomRankLetterColorizerPlugin.Instance; if ((Object)(object)instance == (Object)null) { return rank; } if (1 == 0) { } string result = rank switch { "D" => instance.DText, "C" => instance.CText, "B" => instance.BText, "A" => instance.AText, "S" => instance.SText, "P" => instance.PText, _ => rank, }; if (1 == 0) { } return result; } public static bool HasBorder(string rank) { CustomRankLetterColorizerPlugin instance = CustomRankLetterColorizerPlugin.Instance; if ((Object)(object)instance == (Object)null) { return rank == "P"; } if (1 == 0) { } bool result = rank switch { "D" => instance.DHasBorder, "C" => instance.CHasBorder, "B" => instance.BHasBorder, "A" => instance.AHasBorder, "S" => instance.SHasBorder, "P" => instance.PHasBorder, _ => false, }; if (1 == 0) { } return result; } public static bool IsRankText(string text) { CustomRankLetterColorizerPlugin instance = CustomRankLetterColorizerPlugin.Instance; if ((Object)(object)instance == (Object)null) { return false; } return text == instance.DText || text == instance.CText || text == instance.BText || text == instance.AText || text == instance.SText || text == instance.PText; } public static Color GetBorderColor(string rank) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) CustomRankLetterColorizerPlugin instance = CustomRankLetterColorizerPlugin.Instance; if ((Object)(object)instance == (Object)null) { return (Color)((rank == "P") ? new Color(1f, 0.694f, 0f) : Color.black); } if (1 == 0) { } Color result = (Color)(rank switch { "D" => instance.DBorderColor, "C" => instance.CBorderColor, "B" => instance.BBorderColor, "A" => instance.ABorderColor, "S" => instance.SBorderColor, "P" => instance.PBorderColor, _ => Color.black, }); if (1 == 0) { } return result; } public static Color GetGoldBorderColor() { //IL_0020: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) return (Color)(((??)CustomRankLetterColorizerPlugin.Instance?.GoldBorderColor) ?? new Color(1f, 0.694f, 0f)); } public static Color GetMajorAssistsBackgroundColor() { //IL_0025: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) return (Color)(((??)CustomRankLetterColorizerPlugin.Instance?.MajorAssistsBackgroundColor) ?? new Color(0.3f, 0.6f, 0.9f, 1f)); } public static Color GetMajorAssistsTextColor() { //IL_0025: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) return (Color)(((??)CustomRankLetterColorizerPlugin.Instance?.MajorAssistsTextColor) ?? new Color(0.298f, 0.6f, 0.902f, 1f)); } public static Color GetCheatsBorderColor() { //IL_0020: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) return (Color)(((??)CustomRankLetterColorizerPlugin.Instance?.CheatsBorderColor) ?? new Color(0.25f, 1f, 0.25f)); } public static Color GetCheatsTextColor() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0019: Unknown result type (might be due to invalid IL or missing references) return CustomRankLetterColorizerPlugin.Instance?.CheatsTextColor ?? Color.white; } public static string GetCheatsText() { return CustomRankLetterColorizerPlugin.Instance?.CheatsText ?? "_"; } public static int GetRankPoints(string rank) { if (1 == 0) { } int result = rank switch { "D" => 500, "C" => 1000, "B" => 1500, "A" => 2000, "S" => 2500, "P" => 4000, _ => 0, }; if (1 == 0) { } return result; } } internal static class FinalRankTrueLetters { public static string TimeRank; public static string KillsRank; public static string StyleRank; public static void Clear() { TimeRank = null; KillsRank = null; StyleRank = null; } } internal static class FinalRankHelper { public static string StripColorTag(string rank) { if (string.IsNullOrEmpty(rank)) { return rank; } if (!rank.Contains("<color=")) { return rank; } int num = rank.IndexOf('>') + 1; int num2 = rank.IndexOf("</color>"); if (num > 0 && num2 >= num) { int num3 = num; return rank.Substring(num3, num2 - num3); } return rank; } public static string GetTrueLetter(string rankString) { if (string.IsNullOrEmpty(rankString)) { return null; } if (rankString.Contains("<color=#")) { int num = rankString.IndexOf("<color=#") + 8; if (num + 6 <= rankString.Length) { string key = rankString.Substring(num, 6).ToUpperInvariant(); if (RankColors.VanillaHexToRank.TryGetValue(key, out var value)) { return value; } } } return StripColorTag(rankString); } public static void ApplyBorder(TMP_Text rankText, string rank) { Image borderImg; string rankLetter; if (!((Object)(object)rankText == (Object)null)) { Transform parent = rankText.transform.parent; borderImg = ((parent != null) ? ((Component)parent).GetComponent<Image>() : null); if (!((Object)(object)borderImg == (Object)null)) { rankLetter = StripColorTag(rank); Paint(); UIRefresh.Register((Object)(object)borderImg, Paint); } } void Paint() { //IL_007b: 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) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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) //IL_0047: 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) if (!((Object)(object)borderImg == (Object)null)) { if (RankColors.HasBorder(rankLetter)) { Color val = RankColors.ApplyGammaCorrection(RankColors.GetBorderColor(rankLetter), isFinalRank: true); ((Graphic)borderImg).color = new Color(val.r, val.g, val.b, 1f); } else { ((Graphic)borderImg).color = new Color(0f, 0f, 0f, 0.6275f); } } } } } [HarmonyPatch(typeof(TMP_Text), "set_text")] internal static class RankTextPatch { private static readonly Dictionary<int, float> _origSizes = new Dictionary<int, float>(); private static readonly Dictionary<int, bool> _wasAutoSizing = new Dictionary<int, bool>(); private const float MULTI_LINE_SCALE_MULTIPLIER = 0.7f; private const float PRIME_SANCTUM_SIZE_MULTIPLIER = 8f; private const float OVERALL_MULTILINE_SCALE = 2f; private const float LS_NO_SIBLING_BASE_SIZE = 24f; private static readonly Dictionary<int, float> LS_NO_SIBLING_SIZE_OVERRIDES = new Dictionary<int, float> { { 1, 1f }, { 9, 0.9f }, { 10, 0.8f }, { 11, 0.74f }, { 12, 0.67f }, { 13, 0.61f }, { 14, 0.57f }, { 15, 0.53f }, { 16, 0.5f }, { 17, 0.47f }, { 18, 0.44f }, { 19, 0.42f }, { 20, 0.4f }, { 21, 0.38f }, { 22, 0.36f }, { 23, 0.34f }, { 24, 0.33f }, { 25, 0.31f }, { 26, 0.3f }, { 27, 0.29f }, { 28, 0.27f }, { 29, 0.26f }, { 30, 0.25f } }; private const float LS_SIZE_REDUCTION_PER_CHAR = 4f; private const int LS_REDUCTION_EVERY_N_CHARS = 2; private static readonly Dictionary<int, float> LS_SIZE_OVERRIDES = new Dictionary<int, float> { { 1, 1f }, { 2, 1f }, { 3, 0.917f }, { 4, 0.667f }, { 5, 0.5f }, { 6, 0.417f }, { 7, 0.375f }, { 8, 0.333f }, { 9, 0.292f }, { 10, 0.271f }, { 11, 0.25f }, { 12, 0.229f }, { 13, 0.208f }, { 14, 0.198f }, { 15, 0.188f }, { 16, 0.177f }, { 17, 0.167f }, { 18, 0.156f } }; private static readonly Dictionary<string, string> RankHexPatterns = new Dictionary<string, string> { { "0094FF", "D" }, { "4CFF00", "C" }, { "FFD800", "B" }, { "FF6A00", "A" }, { "FF0000", "S" }, { "FFFFFF", "P" }, { "FFAF00", "P" } }; private static readonly Regex ColorTagRegex = new Regex("<color=#([0-9A-Fa-f]{6})([0-9A-Fa-f]{2})?>(.*?)</color>", RegexOptions.Compiled); private const string VanillaMAYes = "<color=#4C99E6>YES</color>"; private const string BLSCheatsPrefix = "<color=#40FF40FF>"; private const string BLSCheatsSuffix = "</color>"; private const string BLSMAPrefix = "<color=#4C99E6FF>"; private const string BLSMASuffix = "</color>*"; private static int GetLongestLineLength(string text) { int num = 0; int num2 = 0; foreach (char c in text) { if (c == '\n') { if (num2 > num) { num = num2; } num2 = 0; } else { num2++; } } if (num2 > num) { num = num2; } return num; } private static bool GetLevelStatsBaseSize(TMP_Text rankText, out float baseSize) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown Transform parent = rankText.transform.parent; if ((Object)(object)parent != (Object)null) { foreach (Transform item in parent) { Transform val = item; TMP_Text component = ((Component)val).GetComponent<TMP_Text>(); if ((Object)(object)component != (Object)null && (Object)(object)component != (Object)(object)rankText) { baseSize = component.fontSize; return true; } } } baseSize = 24f; return false; } private static bool IsCalledFromAllowedComponent() { StackTrace stackTrace = new StackTrace(); StackFrame[] frames = stackTrace.GetFrames(); for (int i = 0; i < frames.Length; i++) { MethodBase method = frames[i].GetMethod(); if (method == null) { continue; } Type declaringType = method.DeclaringType; if (declaringType == null) { continue; } string name = declaringType.Name; switch (name) { default: if (!(name == "RankIcon")) { if (name == "LevelStats" || name == "StatsManager") { return true; } break; } goto case "FinalRank"; case "FinalRank": case "LevelSelectPanel": case "LayerSelect": case "ChapterSelectButton": return true; } } return false; } private static bool IsInsideLevelStats(TMP_Text t) { return (Object)(object)((Component)t).GetComponentInParent<LevelStats>() != (Object)null; } private static bool IsInsideFinalRank(TMP_Text t) { return (Object)(object)((Component)t).GetComponentInParent<FinalRank>() != (Object)null; } private static bool IsInsidePrimeSanctum(TMP_Text t) { if ((Object)(object)t == (Object)null) { return false; } LevelSelectPanel componentInParent = ((Component)t).GetComponentInParent<LevelSelectPanel>(); if ((Object)(object)componentInParent != (Object)null) { return componentInParent.levelNumber >= 666; } Transform parent = t.transform.parent; while ((Object)(object)parent != (Object)null) { componentInParent = ((Component)parent).GetComponent<LevelSelectPanel>(); if ((Object)(object)componentInParent != (Object)null) { return componentInParent.levelNumber >= 666; } parent = parent.parent; } return false; } private static string IAmSufferingWithThisShit(string hex, string rank) { //IL_0059: 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_0060: Unknown result type (might be due to invalid IL or missing references) List<string> list = new List<string>(); string[] array = new string[6] { "D", "C", "B", "A", "S", "P" }; for (int i = 0; i < array.Length; i++) { if (array[i] != rank) { Color color = RankColors.GetColor(array[i]); string item = ColorUtility.ToHtmlStringRGB(color); list.Add(item); } } list.Add("0094FF"); list.Add("4CFF00"); list.Add("FFD800"); list.Add("FF6A00"); list.Add("FF0000"); list.Add("FFFFFF"); list.Add("FFAF00"); bool flag = false; for (int j = 0; j < list.Count; j++) { if (list[j].ToUpper() == hex.ToUpper()) { flag = true; break; } } if (!flag) { return hex; } int[] array2 = new int[3] { 0, 1, 2 }; int[] array3 = new int[2] { -1, 1 }; for (int k = 0; k < array2.Length; k++) { for (int l = 0; l < array3.Length; l++) { string text = DoTheNudgeThing(hex, array2[k], array3[l]); if (text == null) { continue; } bool flag2 = false; for (int m = 0; m < list.Count; m++) { if (list[m].ToUpper() == text.ToUpper()) { flag2 = true; break; } } if (!flag2) { return text; } } } for (int n = 0; n < array2.Length; n++) { for (int num = 0; num < array3.Length; num++) { string text2 = DoTheNudgeThing(hex, array2[n], array3[num] * 2); if (text2 == null) { continue; } bool flag3 = false; for (int num2 = 0; num2 < list.Count; num2++) { if (list[num2].ToUpper() == text2.ToUpper()) { flag3 = true; break; } } if (!flag3) { return text2; } } } return hex; } private static string DoTheNudgeThing(string hex, int channel, int howMuch) { if (hex.Length != 6) { return null; } string s = hex.Substring(0, 2); string s2 = hex.Substring(2, 2); string s3 = hex.Substring(4, 2); int num = int.Parse(s, NumberStyles.HexNumber); int num2 = int.Parse(s2, NumberStyles.HexNumber); int num3 = int.Parse(s3, NumberStyles.HexNumber); switch (channel) { case 0: num += howMuch; break; case 1: num2 += howMuch; break; case 2: num3 += howMuch; break; } if (num < 0 || num > 255) { return null; } if (num2 < 0 || num2 > 255) { return null; } if (num3 < 0 || num3 > 255) { return null; } return num.ToString("X2") + num2.ToString("X2") + num3.ToString("X2"); } private static float CalcLevelStatsFontSize(string text, TMP_Text rankText) { float baseSize; bool levelStatsBaseSize = GetLevelStatsBaseSize(rankText, out baseSize); Dictionary<int, float> dictionary = (levelStatsBaseSize ? LS_SIZE_OVERRIDES : LS_NO_SIBLING_SIZE_OVERRIDES); if (!levelStatsBaseSize) { baseSize = 24f; } int longestLineLength = GetLongestLineLength(text); if (longestLineLength <= 1) { return baseSize; } float num = 1f; int num2 = -1; foreach (KeyValuePair<int, float> item in dictionary) { if (item.Key <= longestLineLength && item.Key > num2) { num2 = item.Key; num = item.Value; } } return Mathf.Max(baseSize * num, 4f); } private static void Prefix(TMP_Text __instance, ref string value) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(value) || (!IsCalledFromAllowedComponent() && !IsInsideLevelStats(__instance))) { return; } if (value == "<color=#4C99E6>YES</color>") { string text = ColorUtility.ToHtmlStringRGB(RankColors.GetMajorAssistsBackgroundColor()); value = "<color=#" + text + ">YES</color>"; return; } if (IsInsideLevelStats(__instance)) { if (value.StartsWith("<color=#40FF40FF>") && value.EndsWith("</color>") && !value.EndsWith("</color>*")) { string text2 = ColorUtility.ToHtmlStringRGB(RankColors.GetCheatsBorderColor()); string text3 = RankColors.GetCheatsText(); if (text3 == "_") { text3 = "-"; } __instance.enableWordWrapping = false; __instance.enableAutoSizing = false; value = "<color=#" + text2 + ">" + text3 + "</color>"; return; } if (value.StartsWith("<color=#4C99E6FF>") && value.EndsWith("</color>*")) { string obj = value; int length = "<color=#4C99E6FF>".Length; string rank = obj.Substring(length, value.Length - "</color>*".Length - length); string text4 = RankColors.GetText(rank); string text5 = ColorUtility.ToHtmlStringRGB(RankColors.GetMajorAssistsBackgroundColor()); __instance.enableWordWrapping = false; __instance.enableAutoSizing = false; value = "<color=#" + text5 + ">" + text4 + "</color>*"; return; } } if (!value.Contains("<color=#") || value.Contains('\n')) { return; } bool isFinalRank = IsInsideFinalRank(__instance); bool isLevelStats = IsInsideLevelStats(__instance); bool isPrimeSanctum = IsInsidePrimeSanctum(__instance); TMP_Text capturedInstance = __instance; value = ColorTagRegex.Replace(value, delegate(Match match) { //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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Unknown result type (might be due to invalid IL or missing references) string text6 = match.Groups[1].Value.ToUpperInvariant(); string value2 = match.Groups[2].Value; string value3 = match.Groups[3].Value; if (!RankHexPatterns.TryGetValue(text6, out var value4)) { return match.Value; } if (value3 == "YES") { Color goldBorderColor = RankColors.GetGoldBorderColor(); string text7 = ColorUtility.ToHtmlStringRGB(goldBorderColor); return "<color=#" + text7 + ">YES</color>"; } if (value3 == "NO") { return match.Value; } string text8 = RankColors.GetText(value4); string text9 = ((isPrimeSanctum || (isLevelStats && !CustomRankLetterColorizerPlugin.Instance.SpacesToNewlinesInLevelStats)) ? text8 : text8.Replace(' ', '\n')); int instanceID = ((Object)capturedInstance).GetInstanceID(); if (isLevelStats) { capturedInstance.enableWordWrapping = false; capturedInstance.enableAutoSizing = false; capturedInstance.alignment = (TextAlignmentOptions)4100; capturedInstance.fontSize = CalcLevelStatsFontSize(text9, capturedInstance); if (!CustomRankLetterColorizerPlugin.Instance.BLSLoaded) { RectTransform rectTransform = capturedInstance.rectTransform; Vector3 localPosition = ((Transform)rectTransform).localPosition; localPosition.x = 265f; ((Transform)rectTransform).localPosition = localPosition; } bool flag = value4 == "P"; Color color = ((!flag || !((Object)(object)CustomRankLetterColorizerPlugin.Instance != (Object)null)) ? RankColors.GetColor(value4) : (CustomRankLetterColorizerPlugin.Instance.BLSUsesBorderColor ? RankColors.GetBorderColor("P") : RankColors.GetColor("P"))); color = RankColors.ApplyGammaCorrection(color); string hex = ColorUtility.ToHtmlStringRGB(color); hex = IAmSufferingWithThisShit(hex, value4); string capturedRankLS = value4; string capturedAlphaLS = value2; int num = instanceID; bool capturedLsIsPRank = flag; UIRefresh.Register((Object)(object)capturedInstance, delegate { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_0127: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)capturedInstance == (Object)null)) { Color color2 = ((!capturedLsIsPRank || !((Object)(object)CustomRankLetterColorizerPlugin.Instance != (Object)null)) ? RankColors.GetColor(capturedRankLS) : (CustomRankLetterColorizerPlugin.Instance.BLSUsesBorderColor ? RankColors.GetBorderColor("P") : RankColors.GetColor("P"))); color2 = RankColors.ApplyGammaCorrection(color2); CustomRankLetterColorizerPlugin instance = CustomRankLetterColorizerPlugin.Instance; string text10 = ((instance == null || instance.SpacesToNewlinesInLevelStats) ? RankColors.GetText(capturedRankLS).Replace(' ', '\n') : RankColors.GetText(capturedRankLS)); capturedInstance.enableWordWrapping = false; capturedInstance.enableAutoSizing = false; capturedInstance.alignment = (TextAlignmentOptions)4100; capturedInstance.fontSize = CalcLevelStatsFontSize(text10, capturedInstance); string hex3 = ColorUtility.ToHtmlStringRGB(color2); hex3 = IAmSufferingWithThisShit(hex3, capturedRankLS); string text11 = (string.IsNullOrEmpty(capturedAlphaLS) ? ("<color=#" + hex3 + ">" + text10 + "</color>") : ("<color=#" + hex3 + capturedAlphaLS + ">" + text10 + "</color>")); capturedInstance.SetText(text11, true); } }); return string.IsNullOrEmpty(value2) ? ("<color=#" + hex + ">" + text9 + "</color>") : ("<color=#" + hex + value2 + ">" + text9 + "</color>"); } int num2; int num3; if (!isPrimeSanctum) { (num2, num3) = AnalyzeText(text9); } else { num2 = 1; num3 = text9.Length; } if ((text8.Length > 1 && RankColors.IsRankText(text8)) || num2 > 1 || (isPrimeSanctum && num3 > 1)) { capturedInstance.enableWordWrapping = true; capturedInstance.alignment = (TextAlignmentOptions)514; if (!_origSizes.TryGetValue(instanceID, out var value5)) { value5 = capturedInstance.fontSize; _origSizes[instanceID] = value5; _wasAutoSizing[instanceID] = capturedInstance.enableAutoSizing; } float num4 = 1f; if (isPrimeSanctum) { num4 *= 8f; if (num3 > 1) { num4 *= 1f / (float)num3; } } else if (num2 > 1) { num4 = ((num3 <= 1) ? (num4 * 1.4f) : (num4 * (1f / (float)num3 * 0.7f * 2f))); capturedInstance.alignment = (TextAlignmentOptions)514; } else if (num3 > 1) { num4 *= 1f / (float)num3; } capturedInstance.fontSizeMax = value5 * num4; capturedInstance.fontSizeMin = value5 * (0.5f * num4); capturedInstance.enableAutoSizing = true; } else { capturedInstance.enableAutoSizing = false; capturedInstance.enableWordWrapping = false; if (_origSizes.TryGetValue(instanceID, out var value6)) { capturedInstance.fontSize = value6; capturedInstance.enableAutoSizing = _wasAutoSizing[instanceID]; _origSizes.Remove(instanceID); _wasAutoSizing.Remove(instanceID); } } bool flag2 = text6 == "FFAF00"; Color val = ((!flag2 || !((Object)(object)CustomRankLetterColorizerPlugin.Instance != (Object)null)) ? RankColors.GetColor(value4) : (CustomRankLetterColorizerPlugin.Instance.BLSUsesBorderColor ? RankColors.GetBorderColor("P") : RankColors.GetColor("P"))); if ((isFinalRank || isLevelStats) && !flag2) { val = RankColors.ApplyGammaCorrection(val, isFinalRank); } string hex2 = ((!(text6 == "FFAF00" || isFinalRank || isLevelStats)) ? RankColors.GetHexColor(value4) : ColorUtility.ToHtmlStringRGB(val)); hex2 = IAmSufferingWithThisShit(hex2, value4); string capturedRank = value4; bool capturedIsFinalRank = isFinalRank; bool capturedIsBlsPRank = flag2; bool capturedIsPrimeSanctum = isPrimeSanctum; bool capturedIsLevelStats = isLevelStats; string capturedAlpha = value2; int num5 = instanceID; float value7; float capturedOrigSize = (_origSizes.TryGetValue(instanceID, out value7) ? value7 : capturedInstance.fontSize); bool value8; bool flag3 = (_wasAutoSizing.TryGetValue(instanceID, out value8) ? value8 : capturedInstance.enableAutoSizing); UIRefresh.Register((Object)(object)capturedInstance, delegate { //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_0057: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)capturedInstance == (Object)null)) { Color val2 = ((!capturedIsBlsPRank || !((Object)(object)CustomRankLetterColorizerPlugin.Instance != (Object)null)) ? RankColors.GetColor(capturedRank) : (CustomRankLetterColorizerPlugin.Instance.BLSUsesBorderColor ? RankColors.GetBorderColor("P") : RankColors.GetColor("P"))); if (capturedIsFinalRank && !capturedIsBlsPRank) { val2 = RankColors.ApplyGammaCorrection(val2, isFinalRank: true); } string text10 = RankColors.GetText(capturedRank); bool flag4 = CustomRankLetterColorizerPlugin.Instance?.SpacesToNewlinesInLevelStats ?? true; string text11 = ((capturedIsPrimeSanctum || (capturedIsLevelStats && !flag4)) ? text10 : text10.Replace(' ', '\n')); int num6; int num7; if (!capturedIsPrimeSanctum) { (num6, num7) = AnalyzeText(text11); } else { num6 = 1; num7 = text11.Length; } if ((text10.Length > 1 && RankColors.IsRankText(text10)) || num6 > 1 || (capturedIsPrimeSanctum && num7 > 1)) { capturedInstance.enableWordWrapping = true; capturedInstance.alignment = (TextAlignmentOptions)514; float num8 = 1f; if (capturedIsPrimeSanctum) { num8 *= 8f; if (num7 > 1) { num8 *= 1f / (float)num7; } } else if (num6 > 1) { num8 = ((num7 <= 1) ? (num8 * 1.4f) : (num8 * (1f / (float)num7 * 0.7f * 2f))); } else if (num7 > 1) { num8 *= 1f / (float)num7; } capturedInstance.fontSizeMax = capturedOrigSize * num8; capturedInstance.fontSizeMin = capturedOrigSize * (0.5f * num8); capturedInstance.enableAutoSizing = true; } else { capturedInstance.enableAutoSizing = false; capturedInstance.enableWordWrapping = false; capturedInstance.fontSize = capturedOrigSize; } string hex3 = ColorUtility.ToHtmlStringRGB(val2); hex3 = IAmSufferingWithThisShit(hex3, capturedRank); string text12 = (string.IsNullOrEmpty(capturedAlpha) ? ("<color=#" + hex3 + ">" + text11 + "</color>") : ("<color=#" + hex3 + capturedAlpha + ">" + text11 + "</color>")); capturedInstance.SetText(text12, true); } }); return string.IsNullOrEmpty(value2) ? ("<color=#" + hex2 + ">" + text9 + "</color>") : ("<color=#" + hex2 + value2 + ">" + text9 + "</color>"); }); } private static (int lineCount, int maxLineLen) AnalyzeText(string text) { int num = 1; int num2 = 0; int num3 = 0; foreach (char c in text) { if (c == '\n') { if (num3 > num2) { num2 = num3; } num3 = 0; num++; } else { num3++; } } if (num3 > num2) { num2 = num3; } return (lineCount: num, maxLineLen: num2); } } [HarmonyPatch(typeof(ChallengeManager), "OnEnable")] internal static class ChallengeManager_OnEnable_Patch { private static void Postfix(ChallengeManager __instance) { Image img; if (!((Object)(object)__instance.challengePanel == (Object)null)) { img = __instance.challengePanel.GetComponent<Image>(); if (!((Object)(object)img == (Object)null)) { Paint(); UIRefresh.Register((Object)(object)img, Paint); } } void Paint() { //IL_0013: 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_001e: 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_002b: 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_0047: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)img == (Object)null)) { Color val = RankColors.ApplyGammaCorrection(RankColors.GetGoldBorderColor(), isFinalRank: true); ((Graphic)img).color = new Color(val.r, val.g, val.b, ((Graphic)img).color.a); } } } } [HarmonyPatch(typeof(ChallengeManager), "ChallengeDone")] internal static class ChallengeManager_ChallengeDone_Patch { private static void Postfix(ChallengeManager __instance) { Image img; if (!((Object)(object)__instance.challengePanel == (Object)null)) { img = __instance.challengePanel.GetComponent<Image>(); if (!((Object)(object)img == (Object)null)) { Paint(); UIRefresh.Register((Object)(object)img, Paint); } } void Paint() { //IL_0013: 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_001e: 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_002b: 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_0047: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)img == (Object)null)) { Color val = RankColors.ApplyGammaCorrection(RankColors.GetGoldBorderColor(), isFinalRank: true); ((Graphic)img).color = new Color(val.r, val.g, val.b, ((Graphic)img).color.a); } } } } [HarmonyPatch(typeof(LayerSelect), "Gold")] internal static class LayerSelect_Gold_Patch { private static void Postfix(LayerSelect __instance) { Image img; if (__instance.gold) { img = ((Component)__instance).GetComponent<Image>(); Paint(); UIRefresh.Register((Object)(object)img, Paint); } void Paint() { //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_001f: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)img == (Object)null)) { Color goldBorderColor = RankColors.GetGoldBorderColor(); ((Graphic)img).color = new Color(goldBorderColor.r, goldBorderColor.g, goldBorderColor.b, 0.75f); } } } } [HarmonyPatch(typeof(LayerSelect), "SecretMissionDone")] internal static class LayerSelect_SecretMissionDone_Patch { private static void Postfix(LayerSelect __instance) { Image img; if (__instance.gold) { img = ((Component)__instance).GetComponent<Image>(); Paint(); UIRefresh.Register((Object)(object)img, Paint); } void Paint() { //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_001f: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)img == (Object)null)) { Color goldBorderColor = RankColors.GetGoldBorderColor(); ((Graphic)img).color = new Color(goldBorderColor.r, goldBorderColor.g, goldBorderColor.b, 0.75f); } } } } [HarmonyPatch(typeof(LayerSelect), "AddScore")] internal static class LayerSelect_AddScore_Patch { private static void Postfix(LayerSelect __instance) { string rankLetter; Image rankImage; if (!((Object)(object)__instance.rankImage == (Object)null) && __instance.complete) { rankLetter = (__instance.allPerfects ? "P" : GetRankLetterFromScore(__instance.trueScore)); rankImage = __instance.rankImage; Paint(); UIRefresh.Register((Object)(object)rankImage, Paint); } void Paint() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) if (!((Object)(object)rankImage == (Object)null)) { if (RankColors.HasBorder(rankLetter)) { Color borderColor = RankColors.GetBorderColor(rankLetter); ((Graphic)rankImage).color = new Color(borderColor.r, borderColor.g, borderColor.b, 1f); rankImage.sprite = __instance.rankSpriteOnP ?? __instance.rankSpriteOriginal; } else { ((Graphic)rankImage).color = Color.white; rankImage.sprite = __instance.rankSpriteOriginal; } } } } private static string GetRankLetterFromScore(int score) { if (1 == 0) { } string result = ((score >= 4) ? "S" : (score switch { 1 => "C", 2 => "B", 3 => "A", _ => "D", })); if (1 == 0) { } return result; } } [HarmonyPatch(typeof(LevelSelectPanel), "CheckScore")] internal static class LevelSelectPanel_CheckScore_Patch { private static readonly Dictionary<int, Transform> _rankTransformCache = new Dictionary<int, Transform>(); private static void Postfix(LevelSelectPanel __instance) { int missionNumber = GetMissionNumber(__instance); RankData rank = GameProgressSaver.GetRank(missionNumber, false); if (rank == null) { return; } int num = MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0); if (rank.ranks[num] < 0) { return; } bool isMajorAssists = rank.majorAssists != null && rank.majorAssists[num]; string rankLetter = ((rank.ranks[num] == 12 && !isMajorAssists) ? "P" : RankHelper.GetRankLetter(rank.ranks[num])); Image panelImg = ((Component)__instance).GetComponent<Image>(); PaintPanel(); UIRefresh.Register((Object)(object)panelImg, PaintPanel); int instanceID = ((Object)__instance).GetInstanceID(); if (!_rankTransformCache.TryGetValue(instanceID, out var value)) { value = ((Component)__instance).transform.Find("Stats/Rank"); _rankTransformCache[instanceID] = value; } Image rankImage; TMP_Text rankText; if (!((Object)(object)value == (Object)null)) { rankImage = ((Component)value).GetComponent<Image>(); rankText = ((Component)value).GetComponentInChildren<TMP_Text>(); if (!((Object)(object)rankImage == (Object)null) && !((Object)(object)rankText == (Object)null)) { PaintRank(); UIRefresh.Register((Object)(object)rankImage, PaintRank); } } void PaintPanel() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)panelImg == (Object)null)) { if (isMajorAssists) { ((Graphic)panelImg).color = new Color(0f, 0f, 0f, 0.35f); } else if (RankColors.HasBorder(rankLetter)) { Color borderColor = RankColors.GetBorderColor(rankLetter); ((Graphic)panelImg).color = new Color(borderColor.r, borderColor.g, borderColor.b, 0.75f); } else { ((Graphic)panelImg).color = new Color(0f, 0f, 0f, 0.35f); } } } void PaintRank() { //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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0188: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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) //IL_010d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)rankImage == (Object)null) && !((Object)(object)rankText == (Object)null)) { if (isMajorAssists) { Color majorAssistsBackgroundColor = RankColors.GetMajorAssistsBackgroundColor(); ((Graphic)rankImage).color = new Color(majorAssistsBackgroundColor.r, majorAssistsBackgroundColor.g, majorAssistsBackgroundColor.b, 1f); rankImage.sprite = __instance.filledPanel; Color majorAssistsTextColor = RankColors.GetMajorAssistsTextColor(); string text = ColorUtility.ToHtmlStringRGB(majorAssistsTextColor); rankText.text = "<color=#" + text + ">" + rankLetter + "</color>"; } else if (RankColors.HasBorder(rankLetter)) { Color borderColor = RankColors.GetBorderColor(rankLetter); ((Graphic)rankImage).color = new Color(borderColor.r, borderColor.g, borderColor.b, 1f); rankImage.sprite = __instance.filledPanel; string hexColor = RankColors.GetHexColor(rankLetter); rankText.text = "<color=#" + hexColor + ">" + RankColors.GetText(rankLetter) + "</color>"; } else { ((Graphic)rankImage).color = Color.white; rankImage.sprite = __instance.unfilledPanel; string hexColor2 = RankColors.GetHexColor(rankLetter); rankText.text = "<color=#" + hexColor2 + ">" + RankColors.GetText(rankLetter) + "</color>"; } } } } private static int GetMissionNumber(LevelSelectPanel panel) { int num = panel.levelNumber; if (num == 666 || num == 100) { num += panel.levelNumberInLayer - 1; } return num; } } [HarmonyPatch(typeof(LevelSelectPanel), "CheckScore")] internal static class LevelSelectPanel_ChallengeText_Patch { private static void Postfix(LevelSelectPanel __instance) { if ((Object)(object)__instance.challengeIcon == (Object)null) { return; } TMP_Text challengeText = ((Component)__instance.challengeIcon).GetComponentInChildren<TMP_Text>(); bool isMajorAssists; string rankLetter; if (!((Object)(object)challengeText == (Object)null) && !(challengeText.text != "C O M P L E T E")) { RankData rank = GameProgressSaver.GetRank((__instance.levelNumber == 666 || __instance.levelNumber == 100) ? (__instance.levelNumber + __instance.levelNumberInLayer - 1) : __instance.levelNumber, false); if (rank != null) { int num = MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0); isMajorAssists = rank.majorAssists != null && rank.majorAssists[num]; rankLetter = ((rank.ranks[num] == 12 && !isMajorAssists) ? "P" : RankHelper.GetRankLetter(rank.ranks[num])); Paint(); UIRefresh.Register((Object)(object)challengeText, Paint); } } void Paint() { //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_002a: 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_007d: Unknown result type (might be due to invalid IL or missing references) //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_0061: 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) if (!((Object)(object)challengeText == (Object)null)) { if (isMajorAssists) { Color majorAssistsBackgroundColor = RankColors.GetMajorAssistsBackgroundColor(); ((Graphic)challengeText).color = DarkenColor(majorAssistsBackgroundColor, 0.253f); } else if (RankColors.HasBorder(rankLetter)) { Color borderColor = RankColors.GetBorderColor(rankLetter); ((Graphic)challengeText).color = DarkenColor(borderColor, 0.253f); } else { ((Graphic)challengeText).color = Color.black; } } } } private static Color DarkenColor(Color c, float amount) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) return new Color(Mathf.Clamp01(c.r - amount), Mathf.Clamp01(c.g - amount), Mathf.Clamp01(c.b - amount), c.a); } } [HarmonyPatch(typeof(ChapterSelectButton), "CheckScore")] internal static class ChapterSelectButton_CheckScore_Patch { private static void Postfix(ChapterSelectButton __instance) { //IL_01d2: Unknown result type (might be due to invalid IL or missing references) Image rankButton = Traverse.Create((object)__instance).Field("rankButton").GetValue<Image>(); Sprite originalRankSprite = Traverse.Create((object)__instance).Field("originalRankSprite").GetValue<Sprite>(); Image buttonBg; if (__instance.allPerfects == __instance.layersInChapter.Length) { if ((Object)(object)rankButton != (Object)null) { PaintRankButton(); UIRefresh.Register((Object)(object)rankButton, PaintRankButton); } if (__instance.golds == __instance.layersInChapter.Length) { buttonBg = ((Component)__instance).GetComponent<Image>(); if ((Object)(object)buttonBg != (Object)null) { PaintGold(); UIRefresh.Register((Object)(object)buttonBg, PaintGold); } } return; } string rankLetter = GetRankLetterFromAverageScore(__instance); if (rankLetter != null && RankColors.HasBorder(rankLetter) && (Object)(object)rankButton != (Object)null) { PaintRankButton2(); UIRefresh.Register((Object)(object)rankButton, PaintRankButton2); } else { if (!((Object)(object)rankButton != (Object)null)) { return; } ((Graphic)rankButton).color = Color.white; rankButton.sprite = originalRankSprite; UIRefresh.Register((Object)(object)rankButton, delegate { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)rankButton == (Object)null)) { ((Graphic)rankButton).color = Color.white; rankButton.sprite = originalRankSprite; } }); } void PaintGold() { //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_001f: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)buttonBg == (Object)null)) { Color goldBorderColor = RankColors.GetGoldBorderColor(); ((Graphic)buttonBg).color = new Color(goldBorderColor.r, goldBorderColor.g, goldBorderColor.b, 1f); Sprite value = Traverse.Create((object)__instance).Field("buttonOnP").GetValue<Sprite>(); if ((Object)(object)value != (Object)null) { buttonBg.sprite = value; } } } void PaintRankButton() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0042: 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) if (!((Object)(object)rankButton == (Object)null)) { if (RankColors.HasBorder("P")) { Color borderColor = RankColors.GetBorderColor("P"); ((Graphic)rankButton).color = new Color(borderColor.r, borderColor.g, borderColor.b, 1f); Sprite value = Traverse.Create((object)__instance).Field("rankOnP").GetValue<Sprite>(); if ((Object)(object)value != (Object)null) { rankButton.sprite = value; } } else { ((Graphic)rankButton).color = Color.white; rankButton.sprite = originalRankSprite; } } } void PaintRankButton2() { //IL_00b2: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0059: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)rankButton == (Object)null)) { if (RankColors.HasBorder(rankLetter)) { Color borderColor = RankColors.GetBorderColor(rankLetter); ((Graphic)rankButton).color = new Color(borderColor.r, borderColor.g, borderColor.b, 1f); Sprite value = Traverse.Create((object)__instance).Field("rankOnP").GetValue<Sprite>(); if ((Object)(object)value != (Object)null) { rankButton.sprite = value; } } else { ((Graphic)rankButton).color = Color.white; rankButton.sprite = originalRankSprite; } } } } private static string GetRankLetterFromAverageScore(ChapterSelectButton __instance) { if (__instance.notComplete) { return null; } int totalScore = __instance.totalScore; if (1 == 0) { } string result = ((totalScore >= 4) ? "S" : (totalScore switch { 1 => "C", 2 => "B", 3 => "A", _ => "D", })); if (1 == 0) { } return result; } } [HarmonyPatch(typeof(FinalRank), "SetTime")] internal static class FinalRank_SetTime_Patch { private static void Prefix(string rank) { FinalRankTrueLetters.TimeRank = FinalRankHelper.GetTrueLetter(rank); } private static void Postfix(FinalRank __instance, string rank) { FinalRankHelper.ApplyBorder(__instance.timeRank, rank); } } [HarmonyPatch(typeof(FinalRank), "SetKills")] internal static class FinalRank_SetKills_Patch { private static void Prefix(string rank) { FinalRankTrueLetters.KillsRank = FinalRankHelper.GetTrueLetter(rank); } private static void Postfix(FinalRank __instance, string rank) { FinalRankHelper.ApplyBorder(__instance.killsRank, rank); } } [HarmonyPatch(typeof(FinalRank), "SetStyle")] internal static class FinalRank_SetStyle_Patch { private static void Prefix(string rank) { FinalRankTrueLetters.StyleRank = FinalRankHelper.GetTrueLetter(rank); } private static void Postfix(FinalRank __instance, string rank) { FinalRankHelper.ApplyBorder(__instance.styleRank, rank); } } [HarmonyPatch(typeof(FinalRank), "Appear")] internal static class FinalRank_Appear_Patch { private static void Postfix(FinalRank __instance) { int num = (int)typeof(FinalRank).GetField("i", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); if (num <= 0) { return; } GameObject[] toAppear = __instance.toAppear; if (toAppear == null || num > toAppear.Length) { return; } GameObject val = toAppear[num - 1]; if ((Object)(object)val == (Object)null || ((Object)(object)val != (Object)(object)((Component)__instance.timeRank).gameObject && (Object)(object)val != (Object)(object)((Component)__instance.killsRank).gameObject && (Object)(object)val != (Object)(object)((Component)__instance.styleRank).gameObject)) { return; } string text = null; if ((Object)(object)val == (Object)(object)((Component)__instance.timeRank).gameObject) { text = FinalRankTrueLetters.TimeRank; } else if ((Object)(object)val == (Object)(object)((Component)__instance.killsRank).gameObject) { text = FinalRankTrueLetters.KillsRank; } else if ((Object)(object)val == (Object)(object)((Component)__instance.styleRank).gameObject) { text = FinalRankTrueLetters.StyleRank; } if (text == null) { return; } int rankPoints = RankColors.GetRankPoints(text); if (rankPoints == 0) { return; } TMP_Text component = val.GetComponent<TMP_Text>(); if (!((Object)(object)component == (Object)null)) { string text2 = component.text; int num2 = 0; switch (text2) { case "<color=#0094FF>D</color>": num2 = 500; break; case "<color=#4CFF00>C</color>": num2 = 1000; break; case "<color=#FFD800>B</color>": num2 = 1500; break; case "<color=#FF6A00>A</color>": num2 = 2000; break; case "<color=#FF0000>S</color>": num2 = 2500; break; } int num3 = rankPoints - num2; if (num3 != 0) { __instance.AddPoints(num3); } } } } [HarmonyPatch(typeof(StatsManager), "GetFinalRank")] internal static class StatsManager_GetFinalRank_Patch { private static void Postfix(StatsManager __instance) { Image totalRankBg; bool cheatsEnabled; bool majorUsed; bool isPRank; int rankScore; if (!((Object)(object)__instance.fr == (Object)null) && !((Object)(object)__instance.fr.totalRank == (Object)null)) { Transform parent = __instance.fr.totalRank.transform.parent; totalRankBg = ((parent != null) ? ((Component)parent).GetComponent<Image>() : null); if (!((Object)(object)totalRankBg == (Object)null)) { AssistController instance = MonoSingleton<AssistController>.Instance; cheatsEnabled = (Object)(object)instance != (Object)null && instance.cheatsEnabled; majorUsed = __instance.majorUsed; isPRank = __instance.rankScore == 12; rankScore = __instance.rankScore; Paint(); UIRefresh.Register((Object)(object)totalRankBg, Paint); } } void Paint() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0042: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_029f: 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_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)totalRankBg == (Object)null)) { if (cheatsEnabled) { Color val = RankColors.ApplyGammaCorrection(RankColors.GetCheatsBorderColor(), isFinalRank: true); ((Graphic)totalRankBg).color = new Color(val.r, val.g, val.b, 1f); if ((Object)(object)__instance.fr?.totalRank != (Object)null) { Color val2 = RankColors.ApplyGammaCorrection(RankColors.GetCheatsTextColor(), isFinalRank: true); string text = ColorUtility.ToHtmlStringRGB(val2); string cheatsText = RankColors.GetCheatsText(); __instance.fr.totalRank.SetText("<color=#" + text + ">" + cheatsText + "</color>", true); } } else if (majorUsed) { Color val3 = RankColors.ApplyGammaCorrection(RankColors.GetMajorAssistsBackgroundColor(), isFinalRank: true); ((Graphic)totalRankBg).color = new Color(val3.r, val3.g, val3.b, 1f); if ((Object)(object)__instance.fr?.totalRank != (Object)null) { string rankLetter = RankHelper.GetRankLetter(rankScore); Color val4 = RankColors.ApplyGammaCorrection(RankColors.GetMajorAssistsTextColor(), isFinalRank: true); string text2 = ColorUtility.ToHtmlStringRGB(val4); __instance.fr.totalRank.SetText("<color=#" + text2 + ">" + rankLetter + "</color>", true); } } else if (isPRank && RankColors.HasBorder("P")) { Color val5 = RankColors.ApplyGammaCorrection(RankColors.GetBorderColor("P"), isFinalRank: true); ((Graphic)totalRankBg).color = new Color(val5.r, val5.g, val5.b, 1f); } else if (!isPRank) { string rankLetter2 = RankHelper.GetRankLetter(rankScore); if (RankColors.HasBorder(rankLetter2)) { Color val6 = RankColors.ApplyGammaCorrection(RankColors.GetBorderColor(rankLetter2), isFinalRank: true); ((Graphic)totalRankBg).color = new Color(val6.r, val6.g, val6.b, 1f); } else { ((Graphic)totalRankBg).color = new Color(0f, 0f, 0f, 0.6275f); } } else { ((Graphic)totalRankBg).color = new Color(0f, 0f, 0f, 0.6275f); } } } } } [HarmonyPatch(typeof(FinalRank), "SetRank")] internal static class FinalRank_SetRank_Cheats_Patch { private static void Postfix(FinalRank __instance, string rank) { //IL_0033: 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) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance.totalRank == (Object)null)) { AssistController instance = MonoSingleton<AssistController>.Instance; if ((Object)(object)instance != (Object)null && instance.cheatsEnabled) { Color val = RankColors.Ap