using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using MorePaletteScripts; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MorePalette")] [assembly: AssemblyDescription("More Palette for TABS")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("GeeztJeez")] [assembly: AssemblyProduct("MorePalette")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("MorePalette")] [assembly: ComVisible(false)] [assembly: Guid("3a45c3cf-230c-4310-952f-0887d4266a22")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.8.0")] [module: UnverifiableCode] namespace MorePalette { [BepInPlugin("GeeztJeez.MorePalette", "MorePalette", "1.0.8")] internal class Loader : BaseUnityPlugin { public static string modName; public Sprite mainIcon; public AssetBundle bundle; public static string shortModName; private void Init() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown Material val = new Material(Shader.Find("Standard")); val.enableInstancing = true; Utilities.SetOpaque(val); Material auraMaterial = bundle.LoadAsset("MPT_AuraMaterial"); Material invisMaterial = bundle.LoadAsset("InvisibleMaterial"); Material flatWhiteMaterial = bundle.LoadAsset("FlatWhiteMaterial"); Material flatBlackMaterial = bundle.LoadAsset("FlatBlackMaterial"); float[] array = new float[3] { 0.9f, 0.5f, 0.1f }; Utilities.InsertToGame(shortModName + " Others", mainIcon, Generator.GenerateOldPaletteCat(auraMaterial, invisMaterial, flatWhiteMaterial, flatBlackMaterial, mainIcon).ToArray()); Utilities.InsertToGame(shortModName + " OPQ Bright", mainIcon, Generator.GenerateSurfaceBrightVariants(val, mainIcon, 1000000, 50, 2, 3, 4, 1f)); Utilities.InsertToGame(shortModName + " OPQ Dark", mainIcon, Generator.GenerateSurfaceBrightnessVariants(val, mainIcon, 2000000, 70, 2, 2, 1, 6, 0.1f, 0.9f)); Utilities.InsertToGame(shortModName + " OPQ Unique", mainIcon, Generator.GenerateUniqueVariants(val, mainIcon, 4000000, 70, 5, 0.15f, 0.45f, 0.9f, 2, 2)); Utilities.InsertToGame(shortModName + " TSP Normal", mainIcon, Generator.GenerateTransparentNormal(val, mainIcon, 5000000, 50, 4, 0.3f, 1f, array)); Utilities.InsertToGame(shortModName + " TSP Pastel", mainIcon, Generator.GenerateTransparentPastel(val, mainIcon, 6000000, 50, 5, 0.15f, 0.45f, 0.9f, array)); Utilities.InsertToGame(shortModName + " TSP Mono", mainIcon, Generator.GenerateTransparentGreyscale(val, mainIcon, 7000000, 50, array)); Utilities.InsertToGame(shortModName + " TM Normal", mainIcon, Generator.GenerateTeamVariants(val, mainIcon, 10000000, 50, 2, 0.5f, 1f, 0.8f, array, greyscale: false, emissive: false)); Utilities.InsertToGame(shortModName + " TM Classic", mainIcon, Generator.GenerateTeamVariants(val, mainIcon, 16000000, 50, 2, 0.65f, 0.85f, 0.9f, array, greyscale: false, emissive: false)); Utilities.InsertToGame(shortModName + " TM Shades", mainIcon, Generator.GenerateTeamVariants(val, mainIcon, 8000000, 50, 1, 1f, 1f, 1f, array, greyscale: false, emissive: false)); Utilities.InsertToGame(shortModName + " TM Pastel", mainIcon, Generator.GenerateTeamVariants(val, mainIcon, 9000000, 50, 1, 0.4f, 0.4f, 0.95f, array, greyscale: false, emissive: false)); Utilities.InsertToGame(shortModName + " TM Mono", mainIcon, Generator.GenerateTeamVariants(val, mainIcon, 14000000, 50, 1, 0f, 0f, 1f, array, greyscale: true, emissive: false)); Utilities.InsertToGame(shortModName + " TM Neon", mainIcon, Generator.GenerateTeamVariants(val, mainIcon, 11000000, 50, 1, 1f, 1f, 1f, array, greyscale: false, emissive: true)); Utilities.InsertToGame(shortModName + " TM Dark SL", mainIcon, Generator.GenerateSkinTeamDarkVariants(val, mainIcon, 12000000, 48, array)); Utilities.InsertToGame(shortModName + " TM Bright SL", mainIcon, Generator.GenerateSkinTeamBrightVariants(val, mainIcon, 13000000, 48, array)); } static Loader() { modName = "MorePalette"; shortModName = "MP"; } private void Awake() { ((MonoBehaviour)this).StartCoroutine(Call()); } private IEnumerator Call() { yield return (object)new WaitUntil((Func)(() => (Object)(object)Object.FindObjectOfType() != (Object)null)); yield return (object)new WaitUntil((Func)(() => ServiceLocator.GetService() != null)); Debug.Log((object)$"Loading {modName}!"); new Harmony(modName).PatchAll(); bundle = Utilities.LoadBundle("morepaletteassetsbundle"); if ((Object)(object)bundle != (Object)null) { mainIcon = bundle.LoadAsset("placeholder_paintpalette"); Init(); Debug.Log((object)$"Successfully loaded {modName}!"); } else { Debug.LogError((object)$"Failed Loading {modName}, No assets found!"); } } } } namespace MorePaletteScripts { public static class ReflectionUtility { private const BindingFlags Flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; public static object GetField(this T self, string name) where T : class { FieldInfo field = typeof(T).GetField(name, (BindingFlags)(-1)); if (field != null) { return field.GetValue(self); } return null; } public static T SetField(this T self, string name, object value) where T : class { FieldInfo field = typeof(T).GetField(name, (BindingFlags)(-1)); if (field != null) { field.SetValue(self, value); } return self; } } public static class Generator { public static ColorPaletteCatagory[] GenerateSurfaceBrightVariants(Material mat, Sprite mainIcon, int baseID, int hueSteps, int metallicVariants, int smoothnessVariants, int emissionVariants, float value) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) List list = new List(); int num = baseID; for (int i = 0; i < metallicVariants; i++) { float num2 = ((metallicVariants <= 1) ? 0f : ((float)i / (float)(metallicVariants - 1))); for (int j = 0; j < smoothnessVariants; j++) { float num3 = ((smoothnessVariants <= 1) ? 0f : ((float)j / (float)(smoothnessVariants - 1))); for (int k = 0; k < emissionVariants; k++) { float num4 = (float)k + 1f; string name = $"V{value:F1} M{num2:F0} S{num3:F0} E{num4:F0}"; list.Add(GenerateRainbowSurface(mat, mainIcon, name, num, hueSteps, num2, num3, num4, value)); num += hueSteps; } } } return list.ToArray(); } public static ColorPaletteCatagory GenerateRainbowSurface(Material sharedDynamicMaterial, Sprite mainIcon, string name, int idStart, int hueSteps, float metallic, float smoothness, float emission, float value) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) List list = new List(); int num = 0; for (int i = 0; i < hueSteps; i++) { Color val = Color.HSVToRGB((float)i / (float)hueSteps, 1f, value); Material val2 = new Material(sharedDynamicMaterial); val2.enableInstancing = true; Utilities.SetOpaque(val2); val2.SetColor("_Color", val); val2.SetFloat("_Metallic", metallic); val2.SetFloat("_Glossiness", smoothness); if (emission > 0f) { val2.EnableKeyword("_EMISSION"); val2.SetColor("_EmissionColor", val * emission); } list.Add(new ColorPaletteData { ColorIndex = Utilities.GetSafeColorID(idStart + num), m_color = val, m_material = val2 }); num++; } return new ColorPaletteCatagory { name = name, shardImage = mainIcon, Cataogry = (CatagoryType)0, Colors = list.ToArray() }; } public static ColorPaletteCatagory[] GenerateSurfaceBrightnessVariants(Material mat, Sprite mainIcon, int baseID, int hueSteps, int metallicVariants, int smoothnessVariants, int emissionVariants, int brightnessSteps, float minValue, float maxValue) { List list = new List(); int num = baseID; int num2 = 500000; for (int i = 0; i < brightnessSteps; i++) { _ = (float)i / (float)(brightnessSteps - 1); float value = ((brightnessSteps <= 1) ? maxValue : Mathf.Lerp(maxValue, minValue, (float)i / (float)(brightnessSteps - 1))); ColorPaletteCatagory[] collection = GenerateSurfaceBrightVariants(mat, mainIcon, num, hueSteps, metallicVariants, smoothnessVariants, emissionVariants, value); list.AddRange(collection); num += num2; } return list.ToArray(); } public static ColorPaletteCatagory[] GenerateUniqueVariants(Material sharedDynamicMaterial, Sprite mainIcon, int baseID, int hueSteps, int pastelVariants, float pastelMinSat, float pastelMaxSat, float pastelValue, int metallic, int smoothness) { //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_00b0: 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_00ef: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected O, but got Unknown //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) List list = new List(); int num = baseID; int num2 = 300000; float[] array = new float[2] { 0f, 1f }; float[] array2 = new float[2] { 0f, 1f }; for (int i = 0; i < pastelVariants; i++) { float num3 = ((pastelVariants <= 1) ? 0f : ((float)i / (float)(pastelVariants - 1))); float num4 = Mathf.Lerp(pastelMinSat, pastelMaxSat, num3); for (int j = 0; j < 4; j++) { float num5 = array[j % 2]; float num6 = array2[j / 2]; List list2 = new List(); for (int k = 0; k < hueSteps; k++) { Color val = Color.HSVToRGB((float)k / (float)hueSteps, num4, pastelValue); Material val2 = new Material(sharedDynamicMaterial); val2.enableInstancing = true; Utilities.SetOpaque(val2); val2.SetColor("_Color", val); val2.SetFloat("_Metallic", num5); val2.SetFloat("_Glossiness", num6); list2.Add(new ColorPaletteData { ColorIndex = Utilities.GetSafeColorID(num + k), m_color = val, m_material = val2 }); } list.Add(new ColorPaletteCatagory { name = $"S{num4:F1} M{num5:F0} G{num6:F0}", shardImage = mainIcon, Cataogry = (CatagoryType)0, Colors = list2.ToArray() }); num += num2; } } Color val3 = default(Color); for (int l = 0; l < 4; l++) { float num7 = array[l % 2]; float num8 = array2[l / 2]; List list3 = new List(); for (int m = 0; m < hueSteps; m++) { float num9 = ((hueSteps <= 1) ? 0f : ((float)m / (float)(hueSteps - 1))); ((Color)(ref val3))..ctor(num9, num9, num9); Material val4 = new Material(sharedDynamicMaterial); val4.enableInstancing = true; Utilities.SetOpaque(val4); val4.SetColor("_Color", val3); val4.SetFloat("_Metallic", num7); val4.SetFloat("_Glossiness", num8); list3.Add(new ColorPaletteData { ColorIndex = Utilities.GetSafeColorID(num + m), m_color = val3, m_material = val4 }); } list.Add(new ColorPaletteCatagory { name = $"M{num7:F0} G{num8:F0}", shardImage = mainIcon, Cataogry = (CatagoryType)0, Colors = list3.ToArray() }); num += num2; } return list.ToArray(); } public static ColorPaletteCatagory[] GenerateTransparentPastel(Material sharedDynamicMaterial, Sprite mainIcon, int baseID, int hueSteps, int pastelVariants, float pastelMinSat, float pastelMaxSat, float pastelValue, float[] transparentAlphas) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_008f: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) List list = new List(); int num = baseID; int num2 = 300000; for (int i = 0; i < pastelVariants; i++) { float num3 = ((pastelVariants <= 1) ? 0f : ((float)i / (float)(pastelVariants - 1))); float num4 = Mathf.Lerp(pastelMinSat, pastelMaxSat, num3); foreach (float num5 in transparentAlphas) { List list2 = new List(); for (int k = 0; k < hueSteps; k++) { Color val = Color.HSVToRGB((float)k / (float)hueSteps, num4, pastelValue); val.a = num5; Material val2 = new Material(sharedDynamicMaterial); val2.enableInstancing = true; Utilities.SetTransparent(val2); val2.SetColor("_Color", val); list2.Add(new ColorPaletteData { ColorIndex = Utilities.GetSafeColorID(num + k), m_color = val, m_material = val2 }); } list.Add(new ColorPaletteCatagory { name = $"Pastel S{num4:F1} A{num5:F1}", shardImage = mainIcon, Cataogry = (CatagoryType)0, Colors = list2.ToArray() }); num += num2; } } return list.ToArray(); } public static ColorPaletteCatagory[] GenerateTransparentGreyscale(Material sharedDynamicMaterial, Sprite mainIcon, int baseID, int valueSteps, float[] transparentAlphas) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00a3: Unknown result type (might be due to invalid IL or missing references) List list = new List(); int num = baseID; int num2 = 300000; Color val = default(Color); foreach (float num3 in transparentAlphas) { List list2 = new List(); for (int j = 0; j < valueSteps; j++) { float num4 = ((valueSteps <= 1) ? 0f : ((float)j / (float)(valueSteps - 1))); ((Color)(ref val))..ctor(num4, num4, num4, num3); Material val2 = new Material(sharedDynamicMaterial); val2.enableInstancing = true; Utilities.SetTransparent(val2); val2.SetColor("_Color", val); list2.Add(new ColorPaletteData { ColorIndex = Utilities.GetSafeColorID(num + j), m_color = val, m_material = val2 }); } list.Add(new ColorPaletteCatagory { name = $"Gray A{num3:F1}", shardImage = mainIcon, Cataogry = (CatagoryType)0, Colors = list2.ToArray() }); num += num2; } return list.ToArray(); } public static ColorPaletteCatagory[] GenerateTransparentNormal(Material sharedDynamicMaterial, Sprite mainIcon, int baseID, int hueSteps, int brightnessSteps, float minValue, float maxValue, float[] transparentAlphas) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_007c: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) List list = new List(); int num = baseID; int num2 = 300000; for (int i = 0; i < brightnessSteps; i++) { float num3 = ((brightnessSteps <= 1) ? 0f : ((float)i / (float)(brightnessSteps - 1))); float num4 = Mathf.Lerp(maxValue, minValue, num3); foreach (float num5 in transparentAlphas) { List list2 = new List(); for (int k = 0; k < hueSteps; k++) { Color val = Color.HSVToRGB((float)k / (float)hueSteps, 1f, num4); val.a = num5; Material val2 = new Material(sharedDynamicMaterial); val2.enableInstancing = true; Utilities.SetTransparent(val2); val2.SetColor("_Color", val); list2.Add(new ColorPaletteData { ColorIndex = Utilities.GetSafeColorID(num + k), m_color = val, m_material = val2 }); } list.Add(new ColorPaletteCatagory { name = $"Normal V{num4:F1} A{num5:F1}", shardImage = mainIcon, Cataogry = (CatagoryType)0, Colors = list2.ToArray() }); num += num2; } } return list.ToArray(); } public static ColorPaletteCatagory[] GenerateTeamVariants(Material material, Sprite mainIcon, int baseID, int hueSteps, int styleSteps, float minSat, float maxSat, float value, float[] alphaSteps, bool greyscale, bool emissive) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) List list = new List(); int num = baseID; int num2 = 300000; int num3 = styleSteps; if (Mathf.Approximately(minSat, maxSat)) { num3 = 1; } for (int i = 0; i < num3; i++) { float num4 = Utilities.SafeFactor(i, num3); float num5 = Mathf.Lerp(minSat, maxSat, num4); list.Add(GenerateTeamCategory(material, mainIcon, $"Opaque S{num5:F1}", num, hueSteps, num5, value, 1f, transparent: false, greyscale, emissive)); num += num2; foreach (float num6 in alphaSteps) { list.Add(GenerateTeamCategory(material, mainIcon, $"Transparent S{num5:F1} A{num6:F1}", num, hueSteps, num5, value, num6, transparent: true, greyscale, emissive)); num += num2; } } return list.ToArray(); } public static ColorPaletteCatagory GenerateTeamCategory(Material sharedDynamicMaterial, Sprite mainIcon, string name, int idStart, int shadeSteps, float saturation, float value, float alpha, bool transparent, bool greyscale, bool emissive, float secondaryHueOffset = 0.66f) { //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_0099: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) List list = new List(); float num = 0f; float num2 = 0.66f; Color val = default(Color); Color val2 = default(Color); for (int i = 0; i < shadeSteps; i++) { float num3 = ((shadeSteps <= 1) ? value : Mathf.Lerp(0.2f, value, (float)i / (float)(shadeSteps - 1))); if (greyscale) { float num4 = ((shadeSteps <= 1) ? 0.5f : ((float)i / ((float)shadeSteps - 1f))); ((Color)(ref val))..ctor(num4, num4, num4, alpha); ((Color)(ref val2))..ctor(1f - num4, 1f - num4, 1f - num4, alpha); } else { val = Color.HSVToRGB(num, saturation, num3); val2 = Color.HSVToRGB(num2, saturation, num3); val.a = alpha; val2.a = alpha; } Material val3 = new Material(sharedDynamicMaterial); Material val4 = new Material(sharedDynamicMaterial); if (transparent) { Utilities.SetTransparent(val3); Utilities.SetTransparent(val4); } else { Utilities.SetOpaque(val3); Utilities.SetOpaque(val4); } val3.SetColor("_Color", val); val4.SetColor("_Color", val2); if (emissive) { val3.EnableKeyword("_EMISSION"); val4.EnableKeyword("_EMISSION"); val3.SetColor("_EmissionColor", val * 3f); val4.SetColor("_EmissionColor", val2 * 3f); } int safeColorID = Utilities.GetSafeColorID(idStart + i); list.Add(new TeamColorPaletteData { ColorIndex = safeColorID, m_colorRed = val, m_colorBlue = val2, m_materialRed = val3, m_materialBlue = val4 }); } return new ColorPaletteCatagory { name = name, shardImage = mainIcon, Cataogry = (CatagoryType)1, TeamColors = list.ToArray(), Colors = (ColorPaletteData[])(object)new ColorPaletteData[0] }; } public static ColorPaletteCatagory GenerateOthersVariant(Material mat, Sprite mainIcon, string catName, int baseID, int steps, float saturation, float value, float alpha, bool isGreyscale = false, float emissionIntensity = 0f) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) List list = new List(); Color val = default(Color); for (int i = 0; i < steps; i++) { float num = ((steps <= 1) ? 0f : ((float)i / (float)(steps - 1))); if (isGreyscale) { ((Color)(ref val))..ctor(num, num, num, alpha); } else { val = Color.HSVToRGB(num, saturation, value); val.a = alpha; } Material val2 = new Material(mat); val2.SetColor("_Color", val); list.Add(new ColorPaletteData { ColorIndex = Utilities.GetSafeColorID(baseID + i), m_color = val, m_material = val2 }); } return new ColorPaletteCatagory { name = catName, shardImage = mainIcon, Cataogry = (CatagoryType)0, Colors = list.ToArray() }; } public static List GenerateOldPaletteCat(Material auraMaterial, Material invisMaterial, Material flatWhiteMaterial, Material flatBlackMaterial, Sprite mainIcon) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: 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_024b: 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_027c: 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) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(Shader.Find("Standard")); ((Object)val).name = "MP-Grey-Transparent"; val.color = new Color(0.5f, 0.5f, 0.5f, 0.5f); val.SetOverrideTag("RenderType", "Transparent"); val.SetFloat("_Mode", 3f); val.SetInt("_SrcBlend", 5); val.SetInt("_DstBlend", 10); val.EnableKeyword("_ALPHABLEND_ON"); val.renderQueue = 3000; Material val2 = new Material(Shader.Find("Standard")); ((Object)val2).name = "MP-Black-Transparent"; val2.color = new Color(0f, 0f, 0f, 0.5f); val2.SetOverrideTag("RenderType", "Transparent"); val2.SetFloat("_Mode", 3f); val2.SetInt("_SrcBlend", 5); val2.SetInt("_DstBlend", 10); val2.EnableKeyword("_ALPHABLEND_ON"); val2.renderQueue = 3000; Material val3 = new Material(Shader.Find("Standard")); ((Object)val3).name = "MP-White-Transparent"; val3.color = new Color(1f, 1f, 1f, 0.5f); val3.SetOverrideTag("RenderType", "Transparent"); val3.SetFloat("_Mode", 3f); val3.SetInt("_SrcBlend", 5); val3.SetInt("_DstBlend", 10); val3.EnableKeyword("_ALPHABLEND_ON"); val3.renderQueue = 3000; Material val4 = new Material(Shader.Find("Standard")); ((Object)val4).name = "MP-Glow-White"; val4.color = new Color(2f, 2f, 2f, 2f); List list = new List(); list.Add(new ColorPaletteCatagory { name = "Miscs & Old", shardImage = mainIcon, Cataogry = (CatagoryType)0, Colors = (ColorPaletteData[])(object)new ColorPaletteData[6] { new ColorPaletteData { ColorIndex = 7544323, m_color = new Color(0.5f, 0.5f, 0.5f, 0.5f), m_material = invisMaterial }, new ColorPaletteData { ColorIndex = 3423223, m_color = new Color(0.5f, 0.5f, 0.5f, 0.5f), m_material = val }, new ColorPaletteData { ColorIndex = 34232112, m_color = new Color(0.1f, 0.1f, 0.1f, 0.5f), m_material = val2 }, new ColorPaletteData { ColorIndex = 6435322, m_color = new Color(0.9f, 0.9f, 0.9f, 0.5f), m_material = val3 }, new ColorPaletteData { ColorIndex = 5663424, m_color = new Color(2f, 2f, 2f), m_material = val4 }, new ColorPaletteData { ColorIndex = 6435211, m_color = Color.black, m_material = flatBlackMaterial } } }); list.Add(GenerateOthersVariant(auraMaterial, mainIcon, "Aura Rainbow", 15000000, 180, 1f, 1f, 1f)); list.Add(GenerateOthersVariant(auraMaterial, mainIcon, "Aura Greyscale", 15100000, 180, 0f, 1f, 1f, isGreyscale: true)); list.Add(GenerateOthersVariant(flatWhiteMaterial, mainIcon, "Flat Rainbow", 15200000, 180, 1f, 1f, 1f)); list.Add(GenerateOthersVariant(flatWhiteMaterial, mainIcon, "Flat Greyscale", 15300000, 180, 0f, 1f, 1f, isGreyscale: true)); return list; } public static ColorPaletteCatagory[] GenerateSkinTeamDarkVariants(Material material, Sprite mainIcon, int baseID, int shadeSteps, float[] alphaSteps) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) List list = new List(); int num = 100000; list.Add(GenerateSkinTeamDarkCategory(material, mainIcon, "Opaque", baseID, shadeSteps, 1f, transparent: false)); int num2 = baseID + num; foreach (float num3 in alphaSteps) { list.Add(GenerateSkinTeamDarkCategory(material, mainIcon, $"Transparent {num3:F1}", num2, shadeSteps, num3, transparent: true)); num2 += num; } return list.ToArray(); } public static ColorPaletteCatagory GenerateSkinTeamDarkCategory(Material sharedDynamicMaterial, Sprite mainIcon, string name, int idStart, int shadeSteps, float alpha, bool transparent) { //IL_0014: 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_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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_005c: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_0147: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00f5: 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) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) List list = new List(); Color val = Color32.op_Implicit(new Color32((byte)231, (byte)103, (byte)103, byte.MaxValue)); Color val2 = Color32.op_Implicit(new Color32((byte)89, (byte)48, (byte)48, byte.MaxValue)); Color val3 = Color32.op_Implicit(new Color32((byte)108, (byte)142, (byte)209, byte.MaxValue)); Color val4 = Color32.op_Implicit(new Color32((byte)56, (byte)61, (byte)91, byte.MaxValue)); for (int i = 0; i < shadeSteps; i++) { float num = Utilities.SafeFactor(i, shadeSteps); Color val5 = Color.Lerp(val2, val, num); Color val6 = Color.Lerp(val4, val3, num); val5.a = alpha; val6.a = alpha; Material val7 = new Material(sharedDynamicMaterial); Material val8 = new Material(sharedDynamicMaterial); if (transparent) { Utilities.SetTransparent(val7); Utilities.SetTransparent(val8); } else { Utilities.SetOpaque(val7); Utilities.SetOpaque(val8); } val7.SetColor("_Color", val5); val8.SetColor("_Color", val6); list.Add(new TeamColorPaletteData { ColorIndex = Utilities.GetSafeColorID(idStart + i), m_colorRed = val5, m_colorBlue = val6, m_materialRed = val7, m_materialBlue = val8 }); } return new ColorPaletteCatagory { name = name, shardImage = mainIcon, Cataogry = (CatagoryType)1, TeamColors = list.ToArray(), Colors = (ColorPaletteData[])(object)new ColorPaletteData[0] }; } public static ColorPaletteCatagory[] GenerateSkinTeamBrightVariants(Material material, Sprite mainIcon, int baseID, int shadeSteps, float[] alphaSteps) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) List list = new List(); int num = 100000; list.Add(GenerateSkinTeamBrightCategory(material, mainIcon, "Opaque", baseID, shadeSteps, 1f, transparent: false)); int num2 = baseID + num; foreach (float num3 in alphaSteps) { list.Add(GenerateSkinTeamBrightCategory(material, mainIcon, $"Transparent {num3:F1}", num2, shadeSteps, num3, transparent: true)); num2 += num; } return list.ToArray(); } public static ColorPaletteCatagory GenerateSkinTeamBrightCategory(Material sharedDynamicMaterial, Sprite mainIcon, string name, int idStart, int shadeSteps, float alpha, bool transparent) { //IL_0014: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) List list = new List(); Color val = Color32.op_Implicit(new Color32((byte)217, (byte)126, (byte)126, byte.MaxValue)); Color val2 = Color32.op_Implicit(new Color32((byte)231, (byte)103, (byte)103, byte.MaxValue)); Color val3 = Color32.op_Implicit(new Color32((byte)145, (byte)155, (byte)224, byte.MaxValue)); Color val4 = Color32.op_Implicit(new Color32((byte)108, (byte)142, (byte)209, byte.MaxValue)); for (int i = 0; i < shadeSteps; i++) { float num = Utilities.SafeFactor(i, shadeSteps); Color val5 = Color.Lerp(val2, val, num); Color val6 = Color.Lerp(val4, val3, num); val5.a = alpha; val6.a = alpha; Material val7 = new Material(sharedDynamicMaterial); Material val8 = new Material(sharedDynamicMaterial); if (transparent) { Utilities.SetTransparent(val7); Utilities.SetTransparent(val8); } else { Utilities.SetOpaque(val7); Utilities.SetOpaque(val8); } val7.SetColor("_Color", val5); val8.SetColor("_Color", val6); list.Add(new TeamColorPaletteData { ColorIndex = Utilities.GetSafeColorID(idStart + i), m_colorRed = val5, m_colorBlue = val6, m_materialRed = val7, m_materialBlue = val8 }); } return new ColorPaletteCatagory { name = name, shardImage = mainIcon, Cataogry = (CatagoryType)1, TeamColors = list.ToArray(), Colors = (ColorPaletteData[])(object)new ColorPaletteData[0] }; } } public static class Utilities { public static HashSet usedIDs = new HashSet(); public static void SetOpaque(Material mat) { mat.SetFloat("_Mode", 0f); mat.SetInt("_SrcBlend", 1); mat.SetInt("_DstBlend", 0); mat.SetInt("_ZWrite", 1); mat.DisableKeyword("_ALPHATEST_ON"); mat.DisableKeyword("_ALPHABLEND_ON"); mat.DisableKeyword("_ALPHAPREMULTIPLY_ON"); mat.SetFloat("_Metallic", 0f); mat.SetFloat("_Glossiness", 0f); mat.renderQueue = -1; } public static float SafeFactor(int index, int steps) { if (steps > 1) { return (float)index / ((float)steps - 1f); } return 0f; } public static void SetTransparent(Material mat) { mat.SetFloat("_Mode", 3f); mat.SetInt("_SrcBlend", 5); mat.SetInt("_DstBlend", 10); mat.SetInt("_ZWrite", 0); mat.DisableKeyword("_ALPHATEST_ON"); mat.EnableKeyword("_ALPHABLEND_ON"); mat.DisableKeyword("_ALPHAPREMULTIPLY_ON"); mat.SetFloat("_Metallic", 0f); mat.SetFloat("_Glossiness", 0f); mat.renderQueue = 3000; } public static AssetBundle LoadBundle(string name) { Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name); if (manifestResourceStream == null) { return null; } return AssetBundle.LoadFromStream(manifestResourceStream); } public static int GetSafeColorID(int requestedID) { int i; for (i = requestedID; usedIDs.Contains(i); i++) { } usedIDs.Add(i); return i; } public static void InsertToGame(string name, Sprite icon, ColorPaletteCatagory[] kids) { //IL_0026: 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) UnitEditorColorPalette[] array = Resources.FindObjectsOfTypeAll(); foreach (UnitEditorColorPalette obj in array) { List list = ((ParentCatagories[])obj.GetField("m_ColorPalleteParentCatagories")).ToList(); list.Add(new ParentCatagories { name = name, colorWheelSprite = icon, colorPaletteCatagories = kids }); obj.SetField("m_ColorPalleteParentCatagories", list.ToArray()); obj.Initialize(); } } } }