using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using Pigeon.Math; using Pigeon.Movement; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("SkinGenerator")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SkinGenerator")] [assembly: AssemblyTitle("SkinGenerator")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SkinGenerator { public sealed class SkinGeneratorGui { private sealed class SpecialModifierFilter { private readonly string[] ids; private readonly string[] propertyTypeNames; public string Label { get; } public float Width { get; } public SpecialModifierFilter(string label, params string[] ids) : this(label, ids, Array.Empty()) { } public SpecialModifierFilter(string label, string[] ids, string[] propertyTypeNames) { Label = label; this.ids = ids; this.propertyTypeNames = propertyTypeNames; Width = Mathf.Max(82f, (float)label.Length * 8f + 28f); } public bool Matches(string id) { if (string.IsNullOrEmpty(id)) { return false; } for (int i = 0; i < ids.Length; i++) { if (string.Equals(ids[i], id, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } public bool Matches(SkinUpgradeProperty property) { if (property == null) { return false; } string name = ((object)property).GetType().Name; for (int i = 0; i < propertyTypeNames.Length; i++) { if (string.Equals(propertyTypeNames[i], name, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } } private static readonly string[] RarityNames; private static readonly Rarity[] Rarities; private static readonly SpecialModifierFilter[] SpecialModifierFilters; private readonly ManualLogSource logger; private readonly int windowId = "SkinGenerator".GetHashCode(); private readonly List categories = new List(); private readonly List skins = new List(); private readonly List categoryNames = new List(); private readonly List skinNames = new List(); private readonly bool[] specialModifierEnabled = new bool[SpecialModifierFilters.Length]; private readonly Vector2[] scroll = (Vector2[])(object)new Vector2[3]; private const int SpecialSeedSearchAttempts = 4096; private Rect window = new Rect(20f, 120f, 920f, 116f); private bool initialized; private bool visible; private int selectedCategory; private int selectedRarity; private int selectedSkin; private int openDropdown = -1; private string countText = "1"; private string seedText = "0"; private string seedStepText = "1"; private bool useExactSeed; private bool onlyNewRandom = true; private bool randomSpecialOnly; private string lastMessage = "Ready"; private GUIStyle windowStyle; private GUIStyle buttonStyle; private GUIStyle textFieldStyle; private GUIStyle labelStyle; private GUIStyle toggleStyle; private GUIStyle boxStyle; private Texture2D windowTexture; private Texture2D buttonTexture; private Texture2D buttonHoverTexture; private Texture2D buttonActiveTexture; private Texture2D textFieldTexture; private Texture2D textFieldFocusedTexture; private Texture2D boxTexture; public bool Visible { get { return visible; } set { if (visible != value) { visible = value; if (visible) { initialized = false; selectedCategory = 0; selectedSkin = 0; openDropdown = -1; } } } } public SkinGeneratorGui(ManualLogSource logger) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) this.logger = logger; } public void Draw() { //IL_005e: 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_007f: Expected O, but got Unknown //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) if (visible) { if (!LevelData.IsHub) { visible = false; return; } EnsureInitialized(); EnsureStyles(); ((Rect)(ref window)).height = ((openDropdown >= 0) ? 464f : 164f); window = GUI.Window(windowId, window, new WindowFunction(DrawWindow), "Hub skin generator", windowStyle); } } public void Dispose() { //IL_00a8: 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) visible = false; initialized = false; categories.Clear(); skins.Clear(); categoryNames.Clear(); skinNames.Clear(); selectedCategory = 0; selectedRarity = 0; selectedSkin = 0; openDropdown = -1; countText = "1"; seedText = "0"; seedStepText = "1"; useExactSeed = false; onlyNewRandom = true; randomSpecialOnly = false; lastMessage = "Ready"; for (int i = 0; i < scroll.Length; i++) { scroll[i] = Vector2.zero; } for (int j = 0; j < specialModifierEnabled.Length; j++) { specialModifierEnabled[j] = false; } DestroyTexture(ref windowTexture); DestroyTexture(ref buttonTexture); DestroyTexture(ref buttonHoverTexture); DestroyTexture(ref buttonActiveTexture); DestroyTexture(ref textFieldTexture); DestroyTexture(ref textFieldFocusedTexture); DestroyTexture(ref boxTexture); windowStyle = null; buttonStyle = null; textFieldStyle = null; labelStyle = null; toggleStyle = null; boxStyle = null; } private void DrawWindow(int id) { //IL_0019: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01be: 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_021a: 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_0280: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) float num = 12f; DrawDropdown(0, new Rect(num, 28f, 190f, 28f), GetSelected(categoryNames, selectedCategory, "Category"), categoryNames, delegate(int index) { selectedCategory = index; selectedSkin = 0; RefreshSkins(); }); num += 198f; DrawDropdown(1, new Rect(num, 28f, 120f, 28f), RarityNames[selectedRarity], RarityNames, delegate(int index) { selectedRarity = index; selectedSkin = 0; RefreshSkins(); }); num += 128f; DrawDropdown(2, new Rect(num, 28f, 260f, 28f), GetSelected(skinNames, selectedSkin, "Skin"), skinNames, delegate(int index) { selectedSkin = index; }); num += 268f; countText = GUI.TextField(new Rect(num, 28f, 48f, 28f), countText, 4, textFieldStyle); num += 56f; if (GUI.Button(new Rect(num, 28f, 118f, 28f), "Generate", buttonStyle)) { Generate(); } useExactSeed = GUI.Toggle(new Rect(12f, 62f, 96f, 20f), useExactSeed, "Exact seed", toggleStyle); GUI.Label(new Rect(112f, 62f, 38f, 20f), "Seed", labelStyle); seedText = GUI.TextField(new Rect(150f, 58f, 90f, 24f), seedText, 11, textFieldStyle); GUI.Label(new Rect(248f, 62f, 34f, 20f), "Step", labelStyle); seedStepText = GUI.TextField(new Rect(282f, 58f, 60f, 24f), seedStepText, 6, textFieldStyle); onlyNewRandom = GUI.Toggle(new Rect(354f, 62f, 160f, 20f), onlyNewRandom, "Random only new", toggleStyle); randomSpecialOnly = GUI.Toggle(new Rect(524f, 62f, 190f, 20f), randomSpecialOnly, "Random special only", toggleStyle); DrawSpecialModifierToggles(); GUI.Label(new Rect(12f, 136f, ((Rect)(ref window)).width - 24f, 20f), lastMessage, labelStyle); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref window)).width, 22f)); } private void DrawSpecialModifierToggles() { //IL_0015: 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) GUI.Label(new Rect(12f, 88f, 58f, 20f), "Special", labelStyle); float num = 72f; float num2 = 88f; for (int i = 0; i < SpecialModifierFilters.Length; i++) { SpecialModifierFilter specialModifierFilter = SpecialModifierFilters[i]; float width = specialModifierFilter.Width; if (num + width > ((Rect)(ref window)).width - 12f) { num = 72f; num2 += 22f; } specialModifierEnabled[i] = GUI.Toggle(new Rect(num, num2, width, 20f), specialModifierEnabled[i], specialModifierFilter.Label, toggleStyle); num += width + 6f; } } private void Generate() { if (selectedCategory < 0 || selectedCategory >= categories.Count) { lastMessage = "Select category."; return; } int num = ParseInt(countText, 1, 1, 999); int num2 = ParseInt(seedText, 0, int.MinValue, int.MaxValue); int num3 = ParseInt(seedStepText, 1, -100000, 100000); IUpgradable prefab = categories[selectedCategory].GetPrefab(); int num4 = 0; try { for (int i = 0; i < num; i++) { int specialSeed = 0; SkinUpgrade val = (randomSpecialOnly ? GetRandomSpecialSkin(prefab, out specialSeed) : GetSkinForGeneration(prefab)); if ((Object)(object)val == (Object)null) { break; } UpgradeInstance val2 = PlayerData.CreateUpgradeInstance(prefab, (Upgrade)(object)val, true); val2.CanScrap = true; if (randomSpecialOnly) { val2.Seed = specialSeed; } else if (useExactSeed) { val2.Seed = num2 + num3 * i; } PlayerData.CollectInstance(val2, (UnlockFlags)1); num4++; } lastMessage = ((num4 > 0) ? $"Generated {num4} skin(s)." : "No matching skins found."); RefreshSkins(); } catch (Exception ex) { lastMessage = "Skin generation failed. See BepInEx log."; logger.LogError((object)ex); } } private SkinUpgrade GetSkinForGeneration(IUpgradable category) { if (selectedSkin > 0) { int num = selectedSkin - 1; return (num >= 0 && num < skins.Count) ? skins[num] : null; } List list = new List(skins.Count); for (int i = 0; i < skins.Count; i++) { if (!onlyNewRandom || PlayerData.GetUpgradeInfo(category, (Upgrade)(object)skins[i]).TotalInstancesCollected == 0) { list.Add(skins[i]); } } if (list.Count == 0 && onlyNewRandom) { list.AddRange(skins); } return (list.Count == 0) ? null : list[Random.Range(0, list.Count)]; } private SkinUpgrade GetRandomSpecialSkin(IUpgradable category, out int specialSeed) { specialSeed = 0; List list = new List(skins.Count); for (int i = 0; i < skins.Count; i++) { if (!onlyNewRandom || PlayerData.GetUpgradeInfo(category, (Upgrade)(object)skins[i]).TotalInstancesCollected == 0) { list.Add(skins[i]); } } if (list.Count == 0 && onlyNewRandom) { list.AddRange(skins); } for (int j = 0; j < 4096; j++) { if (list.Count <= 0) { break; } SkinUpgrade val = list[Random.Range(0, list.Count)]; int num = Random.Range(int.MinValue, int.MaxValue); if (HasSpecialAttribute(val, num, out var _)) { specialSeed = num; return val; } } return null; } private bool HasSpecialAttribute(SkinUpgrade skin, int seed, out string modifierId) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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) modifierId = null; if ((Object)(object)skin == (Object)null) { return false; } string empty = string.Empty; int num = 0; Enumerator properties = ((Upgrade)skin).GetProperties(); Random val2 = default(Random); ModifierInfo val3 = default(ModifierInfo); while (((Enumerator)(ref properties)).MoveNext()) { num++; UpgradeProperty current = ((Enumerator)(ref properties)).Current; SkinUpgradeProperty val = (SkinUpgradeProperty)(object)((current is SkinUpgradeProperty) ? current : null); if (val == null) { continue; } ((Random)(ref val2))..ctor(Upgrade.ModifyPropertySeed(seed, num)); try { string nameModifier = val.GetNameModifier((Upgrade)(object)skin, empty, val2, seed, ref val3); if (!string.IsNullOrEmpty(nameModifier) && (MatchesEnabledSpecialModifier(val3.ID) || MatchesEnabledSpecialModifier(val))) { modifierId = (string.IsNullOrEmpty(val3.ID) ? ((object)val).GetType().Name : val3.ID); return true; } } catch (Exception) { } } return false; } private bool MatchesEnabledSpecialModifier(SkinUpgradeProperty property) { bool flag = false; for (int i = 0; i < specialModifierEnabled.Length; i++) { if (specialModifierEnabled[i]) { flag = true; break; } } if (!flag) { return false; } for (int j = 0; j < specialModifierEnabled.Length; j++) { if (specialModifierEnabled[j] && SpecialModifierFilters[j].Matches(property)) { return true; } } return false; } private bool MatchesEnabledSpecialModifier(string modifierId) { bool flag = false; for (int i = 0; i < specialModifierEnabled.Length; i++) { if (specialModifierEnabled[i]) { flag = true; break; } } if (!flag) { return true; } for (int j = 0; j < specialModifierEnabled.Length; j++) { if (specialModifierEnabled[j] && SpecialModifierFilters[j].Matches(modifierId)) { return true; } } return false; } private void EnsureInitialized() { if (!initialized || categories.Count <= 0) { initialized = true; RefreshCategories(); RefreshSkins(); } } private void RefreshCategories() { categories.Clear(); categoryNames.Clear(); Player localPlayer = Player.LocalPlayer; if ((Object)(object)localPlayer == (Object)null) { lastMessage = "Local player is not ready."; return; } AddCategory((IUpgradable)(object)localPlayer.Character); IUpgradable[] gear = (IUpgradable[])(object)localPlayer.Gear; IUpgradable[] array = gear; if (array != null) { for (int i = 0; i < array.Length; i++) { AddCategory(array[i]); } } if (categories.Count == 0) { lastMessage = "No equipped gear with skins found."; } } private void AddCategory(IUpgradable item) { if (item == null) { return; } IUpgradable prefab = item.GetPrefab(); object obj; if (prefab == null) { obj = null; } else { GearInfo info = prefab.Info; obj = ((info != null) ? info.Upgrades : null); } if (obj == null || !HasSkin(prefab)) { return; } for (int i = 0; i < categories.Count; i++) { if (categories[i] == prefab || categories[i].Info.ID == prefab.Info.ID) { return; } } categories.Add(prefab); categoryNames.Add(prefab.Info.Name + " [" + prefab.Info.APIName + "]"); } private void RefreshSkins() { //IL_0080: 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_00a1: Unknown result type (might be due to invalid IL or missing references) skins.Clear(); skinNames.Clear(); skinNames.Add("Random skin"); if (selectedCategory < 0 || selectedCategory >= categories.Count) { return; } IUpgradable val = categories[selectedCategory]; List upgrades = val.Info.Upgrades; Rarity val2 = Rarities[selectedRarity]; for (int i = 0; i < upgrades.Count; i++) { Upgrade obj = upgrades[i]; SkinUpgrade val3 = (SkinUpgrade)(object)((obj is SkinUpgrade) ? obj : null); if (val3 != null && ((Upgrade)val3).Rarity == val2) { skins.Add(val3); } } skins.Sort((SkinUpgrade a, SkinUpgrade b) => string.Compare(((Upgrade)a).Name, ((Upgrade)b).Name, StringComparison.OrdinalIgnoreCase)); for (int j = 0; j < skins.Count; j++) { skinNames.Add(((Upgrade)skins[j]).Name + " [" + ((Upgrade)skins[j]).APIName + "]"); } } private static bool HasSkin(IUpgradable item) { List upgrades = item.Info.Upgrades; for (int i = 0; i < upgrades.Count; i++) { if (upgrades[i] is SkinUpgrade) { return true; } } return false; } private void DrawDropdown(int id, Rect rect, string label, IReadOnlyList options, Action onSelected) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) if (GUI.Button(rect, label, buttonStyle)) { openDropdown = ((openDropdown == id) ? (-1) : id); } if (openDropdown != id) { return; } int num = Mathf.Min(Mathf.Max(options.Count, 1), 12); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).x, 160f, ((Rect)(ref rect)).width, (float)num * 24f + 4f); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, ((Rect)(ref rect)).width - 20f, (float)Mathf.Max(1, options.Count) * 24f); GUI.Box(val, GUIContent.none, boxStyle); scroll[id] = GUI.BeginScrollView(val, scroll[id], val2); if (options.Count == 0) { GUI.Label(new Rect(4f, 4f, ((Rect)(ref val2)).width - 8f, 22f), "No items", labelStyle); } Rect val3 = default(Rect); for (int i = 0; i < options.Count; i++) { ((Rect)(ref val3))..ctor(2f, (float)i * 24f + 2f, ((Rect)(ref val2)).width - 4f, 22f); if (GUI.Button(val3, options[i], buttonStyle)) { onSelected(i); openDropdown = -1; } } GUI.EndScrollView(); } private void EnsureStyles() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00ec: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Expected O, but got Unknown //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Expected O, but got Unknown //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Expected O, but got Unknown //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Expected O, but got Unknown //IL_0344: Unknown result type (might be due to invalid IL or missing references) if (windowStyle == null) { Color color = default(Color); ((Color)(ref color))..ctor(0.035f, 0.105f, 0.21f, 0.96f); Color color2 = default(Color); ((Color)(ref color2))..ctor(0.08f, 0.32f, 0.62f, 1f); Color color3 = default(Color); ((Color)(ref color3))..ctor(0.12f, 0.48f, 0.82f, 1f); Color color4 = default(Color); ((Color)(ref color4))..ctor(0.04f, 0.23f, 0.48f, 1f); Color textColor = default(Color); ((Color)(ref textColor))..ctor(0.24f, 0.72f, 1f, 1f); windowTexture = MakeTex(1, 1, color); buttonTexture = MakeTex(1, 1, color2); buttonHoverTexture = MakeTex(1, 1, color3); buttonActiveTexture = MakeTex(1, 1, color4); textFieldTexture = MakeTex(1, 1, new Color(0.02f, 0.08f, 0.16f, 1f)); textFieldFocusedTexture = MakeTex(1, 1, new Color(0.03f, 0.14f, 0.28f, 1f)); boxTexture = MakeTex(1, 1, new Color(0.025f, 0.12f, 0.25f, 0.98f)); windowStyle = new GUIStyle(GUI.skin.window); SetAllStates(windowStyle, windowTexture, new Color(0.82f, 0.95f, 1f)); windowStyle.fontStyle = (FontStyle)1; buttonStyle = new GUIStyle(GUI.skin.button); SetAllStates(buttonStyle, buttonTexture, Color.white); buttonStyle.hover.background = buttonHoverTexture; buttonStyle.active.background = buttonActiveTexture; buttonStyle.onHover.background = buttonHoverTexture; buttonStyle.onActive.background = buttonActiveTexture; buttonStyle.alignment = (TextAnchor)4; textFieldStyle = new GUIStyle(GUI.skin.textField); SetAllStates(textFieldStyle, textFieldTexture, Color.white); textFieldStyle.focused.background = textFieldFocusedTexture; textFieldStyle.active.background = textFieldFocusedTexture; textFieldStyle.onFocused.background = textFieldFocusedTexture; textFieldStyle.onActive.background = textFieldFocusedTexture; labelStyle = new GUIStyle(GUI.skin.label); SetTextColor(labelStyle, new Color(0.76f, 0.92f, 1f)); toggleStyle = new GUIStyle(GUI.skin.toggle); SetTextColor(toggleStyle, new Color(0.76f, 0.92f, 1f)); toggleStyle.alignment = (TextAnchor)3; boxStyle = new GUIStyle(GUI.skin.box); SetAllStates(boxStyle, boxTexture, textColor); } } private static int ParseInt(string text, int fallback, int min, int max) { if (!int.TryParse(text, out var result)) { result = fallback; } return Mathf.Clamp(result, min, max); } private static string GetSelected(IReadOnlyList values, int index, string fallback) { return (index >= 0 && index < values.Count) ? values[index] : fallback; } private static void SetAllStates(GUIStyle style, Texture2D background, Color textColor) { //IL_0008: 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_0024: 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_0040: 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_005c: 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) SetState(style.normal, background, textColor); SetState(style.hover, background, textColor); SetState(style.active, background, textColor); SetState(style.focused, background, textColor); SetState(style.onNormal, background, textColor); SetState(style.onHover, background, textColor); SetState(style.onActive, background, textColor); SetState(style.onFocused, background, textColor); } private static void SetState(GUIStyleState state, Texture2D background, Color textColor) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) state.background = background; state.textColor = textColor; } private static void SetTextColor(GUIStyle style, Color textColor) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002e: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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) style.normal.textColor = textColor; style.hover.textColor = textColor; style.active.textColor = textColor; style.focused.textColor = textColor; style.onNormal.textColor = textColor; style.onHover.textColor = textColor; style.onActive.textColor = textColor; style.onFocused.textColor = textColor; } private static Texture2D MakeTex(int width, int height, Color color) { //IL_0011: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < array.Length; i++) { array[i] = color; } Texture2D val = new Texture2D(width, height); val.SetPixels(array); val.Apply(); return val; } private static void DestroyTexture(ref Texture2D texture) { if (!((Object)(object)texture == (Object)null)) { Object.Destroy((Object)(object)texture); texture = null; } } static SkinGeneratorGui() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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) string[] array = new string[3]; Rarity val = (Rarity)1; array[0] = ((object)(Rarity)(ref val)).ToString(); val = (Rarity)2; array[1] = ((object)(Rarity)(ref val)).ToString(); val = (Rarity)3; array[2] = ((object)(Rarity)(ref val)).ToString(); RarityNames = array; Rarity[] array2 = new Rarity[3]; RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); Rarities = (Rarity[])(object)array2; SpecialModifierFilters = new SpecialModifierFilter[11] { new SpecialModifierFilter("Entombed", "entombed"), new SpecialModifierFilter("Spectral", "spectral"), new SpecialModifierFilter("Shifted", new string[1] { "shifted" }, new string[3] { "SkinUpgradeProperty_ColorCycling", "SkinUpgradeProperty_Hue", "SkinUpgradeProperty_ColorTossing" }), new SpecialModifierFilter("Color cycle", Array.Empty(), new string[1] { "SkinUpgradeProperty_ColorCycling" }), new SpecialModifierFilter("Negative", "negative", "inverted"), new SpecialModifierFilter("Chroma", "chroma"), new SpecialModifierFilter("Pixelated", "pixelated"), new SpecialModifierFilter("Trick/Treat", "trickortreat", "trick", "treat"), new SpecialModifierFilter("Neon", "neon_r", "neon_g", "neon_b", "neon_y", "neon_m"), new SpecialModifierFilter("Infected", "infected"), new SpecialModifierFilter("Bloodmetal", "bloodmetal") }; } } [MycoMod(/*Could not decode attribute arguments.*/)] [BepInPlugin("skingenerator", "SkinGenerator", "1.0.0")] public sealed class SkinGeneratorPlugin : BaseUnityPlugin { public const string PluginGuid = "skingenerator"; public const string PluginName = "SkinGenerator"; public const string PluginVersion = "1.0.0"; private ConfigEntry toggleKey; private SkinGeneratorGui gui; internal static ManualLogSource Log { get; private set; } private void Awake() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; toggleKey = ((BaseUnityPlugin)this).Config.Bind("Interface", "ToggleKey", new KeyboardShortcut((KeyCode)257, Array.Empty()), "Key used to show or hide the hub skin generator interface. Format: Unity KeyCode names like Keypad1, F8, Insert. For shortcuts use: LeftControl + F8."); Log.LogInfo((object)"SkinGenerator loaded."); } private void Update() { //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) if (gui != null && !LevelData.IsHub) { UnloadInterface(); SetCursor(visible: false); } KeyboardShortcut value = toggleKey.Value; if (!((KeyboardShortcut)(ref value)).IsDown()) { return; } if (LevelData.IsHub) { if (gui == null || !gui.Visible) { EnsureInterface(); gui.Visible = true; SetCursor(visible: true); } else { UnloadInterface(); SetCursor(visible: false); } } else { UnloadInterface(); SetCursor(visible: false); Log.LogMessage((object)"Skin generator works only in hub."); } } private void OnGUI() { gui?.Draw(); } private void OnDestroy() { UnloadInterface(); } private void EnsureInterface() { if (gui == null) { gui = new SkinGeneratorGui(Log); } } private void UnloadInterface() { gui?.Dispose(); gui = null; GC.Collect(); } private void SetCursor(bool visible) { if (visible) { Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; } else if (PlayerInput.IsPlayerEnabled && !PlayerInput.IsMenuEnabled) { Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; } } } }