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.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SkinTrade")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SkinTrade")] [assembly: AssemblyTitle("SkinTrade")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SkinTrade { internal static class CrtKit { private static readonly Dictionary _sprites = new Dictionary(); private static readonly Dictionary _textures = new Dictionary(); private static Texture2D _logo; private static bool _logoTried; private static float RoundedRectSdf(float x, float y, float w, float h, float inset, float radius) { //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) float num = w / 2f - inset; float num2 = h / 2f - inset; float num3 = Mathf.Abs(x - w / 2f) - (num - radius); float num4 = Mathf.Abs(y - h / 2f) - (num2 - radius); Vector2 val = new Vector2(Mathf.Max(num3, 0f), Mathf.Max(num4, 0f)); float magnitude = ((Vector2)(ref val)).magnitude; float num5 = Mathf.Min(Mathf.Max(num3, num4), 0f); return magnitude + num5 - radius; } private static Texture2D NewTex(int w, int h, TextureWrapMode wrap = (TextureWrapMode)1, FilterMode filter = (FilterMode)1) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown return new Texture2D(w, h, (TextureFormat)4, false) { wrapMode = wrap, filterMode = filter }; } private static Sprite Sliced(Texture2D tex, float border) { //IL_0019: 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_0038: Unknown result type (might be due to invalid IL or missing references) return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(border, border, border, border)); } public static Sprite RoundedFill(int radius) { //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) string key = "fill" + radius; if (_sprites.TryGetValue(key, out var value)) { return value; } int num = radius * 2 + 8; Texture2D val = NewTex(num, num, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num2 = RoundedRectSdf((float)j + 0.5f, (float)i + 0.5f, num, num, 0f, radius); array[i * num + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(Mathf.Clamp01(0.5f - num2) * 255f)); } } val.SetPixels32(array); val.Apply(); return _sprites[key] = Sliced(val, radius + 2); } public static Sprite RoundedBorder(int radius, int thickness) { //IL_00b4: 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) string key = $"border{radius}_{thickness}"; if (_sprites.TryGetValue(key, out var value)) { return value; } int num = radius * 2 + 8; Texture2D val = NewTex(num, num, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num2 = RoundedRectSdf((float)j + 0.5f, (float)i + 0.5f, num, num, 0f, radius); float num3 = Mathf.Clamp01(0.5f - num2) * Mathf.Clamp01(num2 + (float)thickness + 0.5f); array[i * num + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num3 * 255f)); } } val.SetPixels32(array); val.Apply(); return _sprites[key] = Sliced(val, radius + 2); } public static Sprite BezelFrame(int outerRadius, int inset, int holeRadius) { //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) string key = $"bezel{outerRadius}_{inset}_{holeRadius}"; if (_sprites.TryGetValue(key, out var value)) { return value; } int num = inset + holeRadius + 4; int num2 = num * 2 + 16; Texture2D val = NewTex(num2, num2, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[num2 * num2]; for (int i = 0; i < num2; i++) { for (int j = 0; j < num2; j++) { float x = (float)j + 0.5f; float num3 = (float)i + 0.5f; float num4 = RoundedRectSdf(x, num3, num2, num2, 0f, outerRadius); float num5 = RoundedRectSdf(x, num3, num2, num2, inset, holeRadius); float num6 = Mathf.Clamp01(0.5f - num4) * Mathf.Clamp01(num5 + 0.5f); float num7 = Mathf.Clamp01(1f - num5 / 10f); float num8 = Mathf.Clamp01(1f - (0f - num4) / 6f) * (num3 / (float)num2); byte b = (byte)(Mathf.Clamp01(0.82f - 0.45f * num7 * num7 + 0.25f * num8) * 255f); array[i * num2 + j] = new Color32(b, b, b, (byte)(num6 * 255f)); } } val.SetPixels32(array); val.Apply(); return _sprites[key] = Sliced(val, num); } public static Sprite Coin() { //IL_016a: 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) //IL_0116: 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) if (_sprites.TryGetValue("coin", out var value)) { return value; } Texture2D val = NewTex(96, 96, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[9216]; float num = 48f; for (int i = 0; i < 96; i++) { for (int j = 0; j < 96; j++) { float num2 = (float)j + 0.5f - num; float num3 = (float)i + 0.5f - num; float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3); float num5 = Mathf.Clamp01(num - 1f - num4 + 0.5f); float num6 = ((!(num4 > num - 9f)) ? ((!(num4 > num - 13f)) ? ((!(Mathf.Abs(num4 - (num - 24f)) < 1.6f)) ? 0.85f : 0.6f) : 0.95f) : 0.62f); num6 += 0.15f * Mathf.Clamp01((num3 - num2) / 96f); byte b = (byte)(Mathf.Clamp01(num6) * 255f); array[i * 96 + j] = new Color32(b, b, b, (byte)(num5 * 255f)); } } val.SetPixels32(array); val.Apply(); return _sprites["coin"] = Sprite.Create(val, new Rect(0f, 0f, 96f, 96f), new Vector2(0.5f, 0.5f), 100f); } private static float Noise01(int x, int y, int seed) { int num = x * 374761393 + y * 668265263 + seed * int.MaxValue; int num2 = (num ^ (num >> 13)) * 1274126177; return (float)((num2 ^ (num2 >> 16)) & 0xFFFF) / 65535f; } public static Sprite BevelCap(int radius) { //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) string key = "cap" + radius; if (_sprites.TryGetValue(key, out var value)) { return value; } int num = radius * 2 + 40; int num2 = radius * 2 + 24; Texture2D val = NewTex(num, num2, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[num * num2]; for (int i = 0; i < num2; i++) { for (int j = 0; j < num; j++) { float num3 = RoundedRectSdf((float)j + 0.5f, (float)i + 0.5f, num, num2, 0f, radius); float num4 = Mathf.Clamp01(0.5f - num3); float num5 = (float)i / (float)(num2 - 1); float num6 = Mathf.Lerp(0.62f, 0.96f, num5); float num7 = Mathf.Clamp01(1f + num3 / 5f); float num8 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((num5 - 0.2f) / 0.6f)); num6 += num7 * (0.25f * num8 - 0.35f * (1f - num8)); if (Noise01(j, i, 3) > 0.985f) { num6 *= 0.55f; } num6 *= 0.96f + 0.04f * Noise01(j / 2, i / 2, 7); byte b = (byte)(Mathf.Clamp01(num6) * 255f); array[i * num + j] = new Color32(b, b, b, (byte)(num4 * 255f)); } } val.SetPixels32(array); val.Apply(); return _sprites[key] = Sliced(val, radius + 3); } public static Sprite Recess(int radius) { //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) string key = "recess" + radius; if (_sprites.TryGetValue(key, out var value)) { return value; } int num = radius * 2 + 24; Texture2D val = NewTex(num, num, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num2 = RoundedRectSdf((float)j + 0.5f, (float)i + 0.5f, num, num, 0f, radius); float num3 = Mathf.Clamp01(0.5f - num2); float num4 = Mathf.Clamp01(1f + num2 / 7f); float num5 = (float)i / (float)(num - 1); float num6 = Mathf.SmoothStep(0f, 1f, num5); byte b = (byte)(Mathf.Clamp01(0.15f + num4 * (0.2f * Mathf.Pow(1f - num6, 1.5f) - 0.1f * num6)) * 255f); array[i * num + j] = new Color32(b, b, b, (byte)(num3 * 255f)); } } val.SetPixels32(array); val.Apply(); return _sprites[key] = Sliced(val, radius + 3); } public static Sprite LampBezel(int radius, int thickness) { //IL_0106: 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) string key = $"lbez{radius}_{thickness}"; if (_sprites.TryGetValue(key, out var value)) { return value; } int num = radius * 2 + 16; Texture2D val = NewTex(num, num, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num2 = RoundedRectSdf((float)j + 0.5f, (float)i + 0.5f, num, num, 0f, radius); float num3 = Mathf.Clamp01(0.5f - num2) * Mathf.Clamp01(num2 + (float)thickness + 0.5f); float num4 = (float)(num - j + i) / (2f * (float)num); float num5 = 1f - Mathf.Abs((0f - num2) / (float)thickness - 0.5f) * 2f; byte b = (byte)(Mathf.Clamp01(0.35f + 0.5f * num4 + 0.2f * num5) * 255f); array[i * num + j] = new Color32(b, b, b, (byte)(num3 * 255f)); } } val.SetPixels32(array); val.Apply(); return _sprites[key] = Sliced(val, radius + 3); } public static Sprite Lens(int radius) { //IL_00a9: 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_0112: 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) string key = "lens" + radius; if (_sprites.TryGetValue(key, out var value)) { return value; } int num = radius * 2 + 16; Texture2D val = NewTex(num, num, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[num * num]; float num2 = (float)num / 2f; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num3 = RoundedRectSdf((float)j + 0.5f, (float)i + 0.5f, num, num, 0f, radius); float num4 = Mathf.Clamp01(0.5f - num3); Vector2 val2 = new Vector2((float)j + 0.5f - num2, (float)i + 0.5f - num2 * 0.9f); float num5 = ((Vector2)(ref val2)).magnitude / num2; byte b = (byte)(Mathf.Clamp01(Mathf.Lerp(1f, 0.45f, Mathf.Clamp01(num5)) - 0.25f * Mathf.Clamp01(1f + num3 / 4f)) * 255f); array[i * num + j] = new Color32(b, b, b, (byte)(num4 * 255f)); } } val.SetPixels32(array); val.Apply(); return _sprites[key] = Sliced(val, radius + 3); } public static Sprite SoftGlow() { //IL_0115: 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_005e: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) if (_sprites.TryGetValue("glow", out var value)) { return value; } Texture2D val = NewTex(128, 128, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[16384]; float num = 64f; for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { Vector2 val2 = new Vector2((float)j + 0.5f - num, (float)i + 0.5f - num); float num2 = ((Vector2)(ref val2)).magnitude / num; float num3 = Mathf.Exp((0f - num2) * num2 * 4.5f) * Mathf.Clamp01((1f - num2) * 6f); array[i * 128 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num3 * 255f)); } } val.SetPixels32(array); val.Apply(); return _sprites["glow"] = Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f), 100f); } public static Sprite Rivet() { //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_00ee: Unknown result type (might be due to invalid IL or missing references) if (_sprites.TryGetValue("rivet", out var value)) { return value; } Texture2D val = NewTex(32, 32, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[1024]; float num = 16f; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num2 = (float)j + 0.5f - num; float num3 = (float)i + 0.5f - num; float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3); float num5 = Mathf.Clamp01(num - 1f - num4 + 0.5f); byte b = (byte)(Mathf.Clamp01(0.55f + 0.35f * Mathf.Clamp01((num3 - num2) / 32f + 0.3f) - 0.25f * Mathf.Clamp01((num4 - num + 4f) / 3f)) * 255f); array[i * 32 + j] = new Color32(b, b, b, (byte)(num5 * 255f)); } } val.SetPixels32(array); val.Apply(); return _sprites["rivet"] = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 100f); } public static Texture2D BrushedMetal() { //IL_0092: 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) if (_textures.TryGetValue("brushed", out var value)) { return value; } value = NewTex(256, 128, (TextureWrapMode)0, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[32768]; for (int i = 0; i < 128; i++) { float num = Noise01(0, i, 11); for (int j = 0; j < 256; j++) { byte b = (byte)(Mathf.Clamp01(0.5f + 0.35f * (num - 0.5f) + 0.15f * (Noise01(j / 8, i, 13) - 0.5f)) * 255f); array[i * 256 + j] = new Color32(b, b, b, (byte)40); } } value.SetPixels32(array); value.Apply(); return _textures["brushed"] = value; } public static Texture2D FadeLine() { //IL_0069: 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) if (_textures.TryGetValue("fadeline", out var value)) { return value; } value = NewTex(1, 128, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[128]; for (int i = 0; i < 128; i++) { float num = Mathf.Sin((float)i / 127f * MathF.PI); array[i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(Mathf.Pow(num, 0.7f) * 255f)); } value.SetPixels32(array); value.Apply(); return _textures["fadeline"] = value; } public static Texture2D HousingTexture(float wf, float hf, float inset, float holeBottom, float outerRadius, float holeRadius) { //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: 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_0190: Unknown result type (might be due to invalid IL or missing references) string key = $"housing{wf}_{hf}_{inset}_{holeBottom}"; if (_textures.TryGetValue(key, out var value)) { return value; } int num = (int)wf; int num2 = (int)hf; Texture2D val = NewTex(num, num2, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[num * num2]; float num3 = (float)num - 2f * inset; float num4 = holeBottom - inset; float num5 = (float)num / 2f; float num6 = inset + num4 / 2f; for (int i = 0; i < num2; i++) { float num7 = (float)(num2 - 1 - i) + 0.5f; float num8 = Noise01(0, i, 11) - 0.5f; float num9 = Noise01(1, i / 3, 17) - 0.5f; for (int j = 0; j < num; j++) { float num10 = (float)j + 0.5f; float num11 = RoundedRectSdf(num10, num7, num, num2, 0f, outerRadius); float num12 = Mathf.Abs(num10 - num5) - (num3 / 2f - holeRadius); float num13 = Mathf.Abs(num7 - num6) - (num4 / 2f - holeRadius); Vector2 val2 = new Vector2(Mathf.Max(num12, 0f), Mathf.Max(num13, 0f)); float num14 = ((Vector2)(ref val2)).magnitude + Mathf.Min(Mathf.Max(num12, num13), 0f) - holeRadius; float num15 = Mathf.Clamp01(0.5f - num11) * Mathf.Clamp01(num14 + 0.5f); if (num15 <= 0f) { array[i * num + j] = new Color32((byte)0, (byte)0, (byte)0, (byte)0); continue; } float num16 = 0.82f + (0.07f * num8 + 0.05f * num9 + 0.04f * (Noise01(j / 9, i, 13) - 0.5f)); float num17 = Mathf.Clamp01(1f - num14 / 12f); byte b = (byte)(Mathf.Clamp01(num16 - 0.42f * num17 * num17 + 0.12f * Mathf.Clamp01(1f - (num14 - 12f) / 5f) * Mathf.Clamp01(num14 - 11f) + 0.18f * Mathf.Clamp01(1f + num11 / 6f) * Mathf.Clamp01(1f - num7 / (float)num2 * 2f) - 0.15f * Mathf.Clamp01(1f + num11 / 8f) * Mathf.Clamp01(num7 / (float)num2 * 2f - 1f) - 0.06f * (num7 / (float)num2)) * 255f); array[i * num + j] = new Color32(b, b, b, (byte)(num15 * 255f)); } } val.SetPixels32(array); val.Apply(); return _textures[key] = val; } public static Sprite Knob() { //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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) if (_sprites.TryGetValue("knob", out var value)) { return value; } Texture2D val = NewTex(128, 128, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[16384]; float num = 64f; float num2 = num - 2f; for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { float num3 = (float)j + 0.5f - num; float num4 = (float)i + 0.5f - num; float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4); float num6 = Mathf.Clamp01(num2 - num5 + 0.5f); float num7 = Mathf.Atan2(num4, num3); float num8 = Mathf.Clamp01((num4 - num3) / (2f * num2) + 0.5f); float num9 = ((!(num5 > num2 * 0.78f)) ? ((!(num5 > num2 * 0.72f)) ? (0.5f + 0.4f * num8 * (1f - num5 / num2) + 0.15f * (1f - num5 / (num2 * 0.72f))) : 0.25f) : (0.35f + 0.35f * num8 + 0.18f * Mathf.Sign(Mathf.Sin(num7 * 36f)))); byte b = (byte)(Mathf.Clamp01(num9) * 255f); array[i * 128 + j] = new Color32(b, b, b, (byte)(num6 * 255f)); } } val.SetPixels32(array); val.Apply(); return _sprites["knob"] = Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f), 100f); } public static Sprite GaugeFace() { //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: 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_00c9: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: 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_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) if (_sprites.TryGetValue("gauge", out var value)) { return value; } Texture2D val = NewTex(400, 184, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[73600]; float num = 200f; float num2 = 24f; float num3 = 150f; float num4 = 136f; Color val2 = default(Color); ((Color)(ref val2))..ctor(0.9f, 0.86f, 0.74f); Random random = new Random(7); Color val4 = default(Color); Color val5 = default(Color); Color val6 = default(Color); for (int i = 0; i < 184; i++) { for (int j = 0; j < 400; j++) { float num5 = (float)j + 0.5f - num; float num6 = (float)i + 0.5f - num2; float num7 = Mathf.Sqrt(num5 * num5 + num6 * num6); float num8 = Mathf.Atan2(num5, num6) * 57.29578f; Color val3 = val2 * (0.97f + 0.03f * (float)random.NextDouble()); float num9 = (float)Mathf.Min(j, 399 - j) / 30f; float num10 = (float)Mathf.Min(i, 183 - i) / 24f; val3 *= Mathf.Lerp(0.72f, 1f, Mathf.Clamp01(Mathf.Min(num9, num10))); if (Mathf.Abs(num8) <= 55f && num7 >= num4 && num7 <= num3) { float num11 = (num8 + 55f) / 110f; ((Color)(ref val4))..ctor(0.72f, 0.2f, 0.13f); ((Color)(ref val5))..ctor(0.86f, 0.6f, 0.16f); ((Color)(ref val6))..ctor(0.3f, 0.62f, 0.26f); Color val7 = ((num11 < 0.5f) ? Color.Lerp(val4, val5, num11 * 2f) : Color.Lerp(val5, val6, (num11 - 0.5f) * 2f)); float num12 = Mathf.Clamp01(Mathf.Min(num7 - num4, num3 - num7)); val3 = Color.Lerp(val3, val7, num12); } for (int k = -5; k <= 5; k++) { float num13 = (float)k * 11f; bool flag = k == 0 || k == -5 || k == 5; float num14 = (flag ? 112f : 124f); if (!(num7 < num14) && !(num7 > num3 + 2f)) { float num15 = Mathf.Abs(num7 * Mathf.Sin((num8 - num13) * (MathF.PI / 180f))); if (!(Mathf.Abs(num8 - num13) > 20f)) { float num16 = Mathf.Clamp01((flag ? 2.2f : 1.5f) - num15); val3 = Color.Lerp(val3, new Color(0.14f, 0.12f, 0.09f), num16); } } } float num17 = Mathf.Max(0f, Mathf.Max(28f - ((float)j + 0.5f), (float)j + 0.5f - 372f)); float num18 = Mathf.Max(0f, Mathf.Max(28f - ((float)i + 0.5f), (float)i + 0.5f - 156f)); val3.a = Mathf.Clamp01(28f - Mathf.Sqrt(num17 * num17 + num18 * num18) + 0.5f); array[i * 400 + j] = Color32.op_Implicit(val3); } } val.SetPixels32(array); val.Apply(); return _sprites["gauge"] = Sprite.Create(val, new Rect(0f, 0f, 400f, 184f), new Vector2(0.5f, 0.5f), 100f); } public static Sprite Arrow() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_0120: 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) if (_sprites.TryGetValue("arrow", out var value)) { return value; } Texture2D val = NewTex(64, 64, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[4096]; Vector2[] poly = (Vector2[])(object)new Vector2[4] { new Vector2(14f, 6f), new Vector2(56f, 32f), new Vector2(14f, 58f), new Vector2(22f, 32f) }; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { int num = 0; for (int k = 0; k < 4; k++) { for (int l = 0; l < 4; l++) { if (Inside(poly, new Vector2((float)j + ((float)l + 0.5f) / 4f, (float)i + ((float)k + 0.5f) / 4f))) { num++; } } } array[i * 64 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num * 255 / 16)); } } val.SetPixels32(array); val.Apply(); return _sprites["arrow"] = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f); } public static Sprite Star() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) if (_sprites.TryGetValue("star", out var value)) { return value; } Texture2D val = NewTex(64, 64, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[4096]; Vector2[] array2 = (Vector2[])(object)new Vector2[10]; for (int i = 0; i < 10; i++) { float num = ((i % 2 == 0) ? 30f : 12.5f); float num2 = MathF.PI / 2f + (float)i * MathF.PI / 5f; array2[i] = new Vector2(32f + num * Mathf.Cos(num2), 31f + num * Mathf.Sin(num2)); } for (int j = 0; j < 64; j++) { for (int k = 0; k < 64; k++) { int num3 = 0; for (int l = 0; l < 4; l++) { for (int m = 0; m < 4; m++) { if (Inside(array2, new Vector2((float)k + ((float)m + 0.5f) / 4f, (float)j + ((float)l + 0.5f) / 4f))) { num3++; } } } array[j * 64 + k] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num3 * 255 / 16)); } } val.SetPixels32(array); val.Apply(); return _sprites["star"] = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f); } public static Texture2D Logo() { //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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown if (_logoTried) { return _logo; } _logoTried = true; try { using Stream stream = typeof(CrtKit).Assembly.GetManifestResourceStream("SkinTrade.logo.png"); if (stream == null) { return null; } byte[] array = new byte[stream.Length]; int num; for (int i = 0; i < array.Length; i += num) { num = stream.Read(array, i, array.Length - i); if (num <= 0) { break; } } MethodInfo methodInfo = GameBridge.FindType("UnityEngine.ImageConversion")?.GetMethod("LoadImage", new Type[2] { typeof(Texture2D), typeof(byte[]) }); if (methodInfo == null) { return null; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)2, anisoLevel = 4 }; if (!(bool)methodInfo.Invoke(null, new object[2] { val, array })) { return null; } ((Object)val).hideFlags = (HideFlags)61; _logo = val; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Logo could not be loaded: " + ex.Message)); } return _logo; } public static Sprite MenuPointer() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_0120: 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) if (_sprites.TryGetValue("pointer", out var value)) { return value; } Texture2D val = NewTex(64, 64, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[4096]; Vector2[] poly = (Vector2[])(object)new Vector2[4] { new Vector2(6f, 58f), new Vector2(58f, 38f), new Vector2(33f, 31f), new Vector2(22f, 6f) }; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { int num = 0; for (int k = 0; k < 4; k++) { for (int l = 0; l < 4; l++) { if (Inside(poly, new Vector2((float)j + ((float)l + 0.5f) / 4f, (float)i + ((float)k + 0.5f) / 4f))) { num++; } } } array[i * 64 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num * 255 / 16)); } } val.SetPixels32(array); val.Apply(); return _sprites["pointer"] = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.1f, 0.9f), 100f); } public static Sprite Shirt() { //IL_003f: 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_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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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) //IL_0086: 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_00ad: 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_00c3: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_011d: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0162: 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_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) if (_sprites.TryGetValue("shirt", out var value)) { return value; } Texture2D val = NewTex(64, 64, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[4096]; Vector2[] poly = (Vector2[])(object)new Vector2[14] { new Vector2(22f, 54f), new Vector2(27f, 54f), new Vector2(29.5f, 50f), new Vector2(34.5f, 50f), new Vector2(37f, 54f), new Vector2(42f, 54f), new Vector2(58f, 44f), new Vector2(52f, 33f), new Vector2(46f, 37f), new Vector2(46f, 8f), new Vector2(18f, 8f), new Vector2(18f, 37f), new Vector2(12f, 33f), new Vector2(6f, 44f) }; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { int num = 0; for (int k = 0; k < 4; k++) { for (int l = 0; l < 4; l++) { if (Inside(poly, new Vector2((float)j + ((float)l + 0.5f) / 4f, (float)i + ((float)k + 0.5f) / 4f))) { num++; } } } array[i * 64 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num * 255 / 16)); } } val.SetPixels32(array); val.Apply(); return _sprites["shirt"] = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f); } private static bool Inside(Vector2[] poly, Vector2 p) { //IL_001b: 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_0039: 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) bool flag = false; int num = 0; int num2 = poly.Length - 1; while (num < poly.Length) { if (poly[num].y > p.y != poly[num2].y > p.y && p.x < (poly[num2].x - poly[num].x) * (p.y - poly[num].y) / (poly[num2].y - poly[num].y) + poly[num].x) { flag = !flag; } num2 = num++; } return flag; } public static Texture2D Paper() { //IL_0112: 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) if (_textures.TryGetValue("paper", out var value)) { return value; } value = NewTex(256, 512, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[131072]; for (int i = 0; i < 512; i++) { for (int j = 0; j < 256; j++) { float num = Mathf.Abs((float)(j % 16) - 8f) / 8f * 7f; float num2 = (((float)i < num) ? 0f : 1f); byte b = (byte)(Mathf.Clamp01(0.95f + 0.012f * (Noise01(j / 3, i / 3, 21) - 0.5f) + 0.025f * (Mathf.PerlinNoise((float)j * 0.012f, (float)i * 0.012f) - 0.5f) + (Crease(j, i, 256, 151f, 0.06f, 0.55f) + Crease(j, i, 256, 356f, -0.035f, 0.4f))) * 255f); array[i * 256 + j] = new Color32(b, b, b, (byte)(num2 * 255f)); } } value.SetPixels32(array); value.Apply(); return _textures["paper"] = value; } private static float Crease(int x, int y, int w, float baseY, float tilt, float strength) { float num = baseY + ((float)x - (float)w / 2f) * tilt + 3f * Mathf.Sin((float)x * 0.03f); float num2 = (float)y - num; float num3 = 0.5f + 0.5f * Mathf.Sin((float)x * 0.021f + baseY); return ((num2 < 0f) ? ((0f - Mathf.Exp(num2 / 1.6f)) * 0.07f) : (Mathf.Exp((0f - num2) / 5f) * 0.035f)) * strength * (0.4f + 0.6f * num3); } public static Texture2D Scanlines() { //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_003d: 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_004e: 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_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) if (_textures.TryGetValue("scan", out var value)) { return value; } value = NewTex(1, 4, (TextureWrapMode)0, (FilterMode)0); value.SetPixels32((Color32[])(object)new Color32[4] { new Color32((byte)0, (byte)0, (byte)0, (byte)0), new Color32((byte)0, (byte)0, (byte)0, (byte)20), new Color32((byte)0, (byte)0, (byte)0, (byte)110), new Color32((byte)0, (byte)0, (byte)0, (byte)55) }); value.Apply(); return _textures["scan"] = value; } public static Texture2D Noise() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (_textures.TryGetValue("noise", out var value)) { return value; } value = NewTex(128, 128, (TextureWrapMode)0, (FilterMode)0); Random random = new Random(1234); Color32[] array = (Color32[])(object)new Color32[16384]; for (int i = 0; i < array.Length; i++) { byte b = (byte)random.Next(0, 256); array[i] = new Color32(b, b, b, (byte)random.Next(0, 40)); } value.SetPixels32(array); value.Apply(); return _textures["noise"] = value; } public static Sprite Ring() { //IL_0115: 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_0058: 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_00c1: 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) if (_sprites.TryGetValue("ring", out var value)) { return value; } Texture2D val = NewTex(64, 64, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[4096]; float num = 32f; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { Vector2 val2 = new Vector2((float)j + 0.5f - num, (float)i + 0.5f - num); float num2 = ((Vector2)(ref val2)).magnitude / num; float num3 = Mathf.Clamp01(Mathf.Min(num2 - 0.62f, 0.86f - num2) * num); float num4 = Mathf.Clamp01((0.16f - num2) * num); array[i * 64 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(Mathf.Max(num3, num4) * 255f)); } } val.SetPixels32(array); val.Apply(); return _sprites["ring"] = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f); } public static Texture2D Static() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) if (_textures.TryGetValue("static", out var value)) { return value; } value = NewTex(256, 256, (TextureWrapMode)0, (FilterMode)0); Random random = new Random(4321); Color32[] array = (Color32[])(object)new Color32[65536]; for (int i = 0; i < 256; i++) { float num = 0.75f + 0.25f * (float)random.NextDouble(); for (int j = 0; j < 256; j++) { byte b = (byte)Mathf.Clamp((float)random.NextDouble() * 255f * num, 0f, 255f); array[i * 256 + j] = new Color32(b, b, b, byte.MaxValue); } } value.SetPixels32(array); value.Apply(); return _textures["static"] = value; } public static Texture2D Vignette() { //IL_00e1: 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) if (_textures.TryGetValue("vig", out var value)) { return value; } value = NewTex(128, 128, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[16384]; for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { float num = ((float)j + 0.5f) / 128f * 2f - 1f; float num2 = ((float)i + 0.5f) / 128f * 2f - 1f; float num3 = Mathf.Pow(Mathf.Pow(Mathf.Abs(num), 4f) + Mathf.Pow(Mathf.Abs(num2), 4f), 0.25f); float num4 = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.72f, 1.05f, num3)) * 0.62f; array[i * 128 + j] = new Color32((byte)0, (byte)0, (byte)0, (byte)(num4 * 255f)); } } value.SetPixels32(array); value.Apply(); return _textures["vig"] = value; } public static Texture2D Glare() { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) if (_textures.TryGetValue("glare", out var value)) { return value; } value = NewTex(128, 128, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[16384]; for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { float num = (float)j / 128f; float num2 = (float)i / 128f; float num3 = Mathf.Clamp01(1f - Mathf.Abs(num + (1f - num2) - 0.55f) * 3.5f); float num4 = num3 * num3 * 0.07f * Mathf.Clamp01(1.4f - num); array[i * 128 + j] = new Color32(byte.MaxValue, (byte)240, (byte)210, (byte)(num4 * 255f)); } } value.SetPixels32(array); value.Apply(); return _textures["glare"] = value; } public static Texture2D RollBand() { //IL_005b: 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) if (_textures.TryGetValue("roll", out var value)) { return value; } value = NewTex(1, 64, (TextureWrapMode)1, (FilterMode)1); Color32[] array = (Color32[])(object)new Color32[64]; for (int i = 0; i < 64; i++) { float num = Mathf.Sin((float)i / 63f * MathF.PI); array[i] = new Color32(byte.MaxValue, (byte)230, (byte)170, (byte)(num * num * 16f)); } value.SetPixels32(array); value.Apply(); return _textures["roll"] = value; } } internal sealed class CurvedRawImage : RawImage { private const int Segments = 32; private const int TearRows = 56; private float _curvature; private float _tear; private float _roll; private float _seed; public float Curvature { get { return _curvature; } set { value = Mathf.Clamp(value, 0f, 0.3f); if (!Mathf.Approximately(value, _curvature)) { _curvature = value; ((Graphic)this).SetVerticesDirty(); } } } public void SetGlitch(float tear, float roll, float seed) { if (!Mathf.Approximately(tear, _tear) || !Mathf.Approximately(roll, _roll) || !Mathf.Approximately(seed, _seed)) { _tear = tear; _roll = roll; _seed = seed; ((Graphic)this).SetVerticesDirty(); } } private static float Hash(float a, float b) { float num = Mathf.Sin(a * 127.1f + b * 311.7f) * 43758.547f; return num - Mathf.Floor(num); } public static Vector2 Warp(Vector2 q, float k) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_001d: 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_003e: 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) if (k <= 0f) { return q; } float num = (q.x * q.x + q.y * q.y) * 0.5f; return q * ((1f - k * num) / (1f - k)); } public static Vector2 Unwarp(Vector2 p, float k) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) //IL_0010: 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_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_0032: 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_0049: 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 (k <= 0f) { return p; } Vector2 val = p; for (int i = 0; i < 8; i++) { float num = (val.x * val.x + val.y * val.y) * 0.5f; val = p * ((1f - k) / (1f - k * num)); } return val; } protected override void OnPopulateMesh(VertexHelper vh) { //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_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_003c: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_007c: 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) //IL_008c: 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_0097: 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) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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) if (_tear > 0.001f || Mathf.Abs(_roll) > 0.0001f) { PopulateGlitched(vh); return; } vh.Clear(); Rect pixelAdjustedRect = ((Graphic)this).GetPixelAdjustedRect(); Rect uvRect = ((RawImage)this).uvRect; Color32 val = Color32.op_Implicit(((Graphic)this).color); Vector2 val2 = default(Vector2); Vector3 val4 = default(Vector3); for (int i = 0; i <= 32; i++) { for (int j = 0; j <= 32; j++) { ((Vector2)(ref val2))..ctor((float)j / 32f, (float)i / 32f); Vector2 val3 = Warp(val2 * 2f - Vector2.one, _curvature); ((Vector3)(ref val4))..ctor(((Rect)(ref pixelAdjustedRect)).center.x + val3.x * ((Rect)(ref pixelAdjustedRect)).width * 0.5f, ((Rect)(ref pixelAdjustedRect)).center.y + val3.y * ((Rect)(ref pixelAdjustedRect)).height * 0.5f, 0f); vh.AddVert(val4, val, Vector4.op_Implicit(new Vector2(((Rect)(ref uvRect)).x + val2.x * ((Rect)(ref uvRect)).width, ((Rect)(ref uvRect)).y + val2.y * ((Rect)(ref uvRect)).height))); } } int num = 33; for (int k = 0; k < 32; k++) { for (int l = 0; l < 32; l++) { int num2 = k * num + l; vh.AddTriangle(num2, num2 + num, num2 + num + 1); vh.AddTriangle(num2, num2 + num + 1, num2 + 1); } } } private void PopulateGlitched(VertexHelper vh) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_011c: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_019f: Unknown result type (might be due to invalid IL or missing references) vh.Clear(); Rect pixelAdjustedRect = ((Graphic)this).GetPixelAdjustedRect(); Rect uvRect = ((RawImage)this).uvRect; Color32 val = Color32.op_Implicit(((Graphic)this).color); int num = 0; Vector3 val3 = default(Vector3); for (int i = 0; i < 56; i++) { float num2 = Hash(i, _seed); float num3 = ((num2 > 0.78f) ? ((Hash((float)i + 17f, _seed) - 0.5f) * 0.32f) : ((num2 - 0.5f) * 0.025f)); float num4 = Mathf.Sin((float)i * 0.45f + _seed * 3.1f) * 0.012f; float num5 = (num3 + num4) * _tear; float num6 = (float)i / 56f; float num7 = (float)(i + 1) / 56f; for (int j = 0; j <= 32; j++) { float num8 = (float)j / 32f; float[] array = new float[2] { num6, num7 }; foreach (float num9 in array) { Vector2 val2 = Warp(new Vector2(num8, num9) * 2f - Vector2.one, _curvature); ((Vector3)(ref val3))..ctor(((Rect)(ref pixelAdjustedRect)).center.x + val2.x * ((Rect)(ref pixelAdjustedRect)).width * 0.5f, ((Rect)(ref pixelAdjustedRect)).center.y + val2.y * ((Rect)(ref pixelAdjustedRect)).height * 0.5f, 0f); vh.AddVert(val3, val, Vector4.op_Implicit(new Vector2(((Rect)(ref uvRect)).x + (num8 + num5) * ((Rect)(ref uvRect)).width, ((Rect)(ref uvRect)).y + (num9 + _roll) * ((Rect)(ref uvRect)).height))); } } for (int l = 0; l < 32; l++) { int num10 = num + l * 2; vh.AddTriangle(num10, num10 + 1, num10 + 3); vh.AddTriangle(num10, num10 + 3, num10 + 2); } num += 66; } } } internal sealed class DealAnnouncer : MonoBehaviour { private struct Step { public float At; public string Text; } private float _start = -1f; private Step[] _steps; private float _length; private Color _main; private Color _flash; private Action _onDone; private string _shown; private float _shownAt; private string _hint; private float _hintAt; private int _hintTyped; private const float TextY = 330f; private Image _glow; private Canvas _canvas; private TextMeshProUGUI _text; private TextMeshProUGUI _hintText; private string _invite; private float _inviteAlpha; private float _inviteAt; private int _inviteTyped; private TextMeshProUGUI _inviteText; private string _prompt; private float _promptAlpha; private TextMeshProUGUI _promptText; public void ShowAsk(string hint) { //IL_0070: 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) List list = new List(); float num = 0f; for (int i = 1; i <= "WANNA TRADE?".Length; i++) { if ("WANNA TRADE?"[i - 1] != ' ') { list.Add(new Step { At = num, Text = "WANNA TRADE?".Substring(0, i) }); num += 0.075f; } } Play(list.ToArray(), -1f, UiKit.Yellow, Color.white, null); _hint = hint; _hintAt = Time.unscaledTime + num + 0.15f; _hintTyped = 0; } public void PlayConfirm(Action onDone) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) List list = new List(); for (int i = 1; i <= 3; i++) { list.Add(new Step { At = 0.34f * (float)(i - 1), Text = new string('.', i) }); } float num = 1.35f; for (int j = 1; j <= "LET'S GO".Length; j++) { if ("LET'S GO"[j - 1] != ' ') { list.Add(new Step { At = num, Text = "LET'S GO".Substring(0, j) }); num += 0.075f; } } Play(list.ToArray(), 2.75f, UiKit.Yellow, Color.white, onDone); } public void PlayResult(bool success, string text) { //IL_003a: 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_003f: Unknown result type (might be due to invalid IL or missing references) Play(new Step[1] { new Step { At = 0f, Text = text } }, 1.8f, success ? UiKit.Green : UiKit.Red, Color.white, null); if (success) { Sfx.Type(1.5f); } else { Sfx.Deny(); } } public void Stop() { _start = -1f; _shown = null; _hint = null; if ((Object)(object)_text != (Object)null) { ((Component)_text).gameObject.SetActive(false); } if ((Object)(object)_glow != (Object)null) { ((Component)_glow).gameObject.SetActive(false); } if ((Object)(object)_hintText != (Object)null) { ((Component)_hintText).gameObject.SetActive(false); } } private void Play(Step[] steps, float length, Color main, Color flash, Action onDone) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0018: Unknown result type (might be due to invalid IL or missing references) _steps = steps; _length = length; _main = main; _flash = flash; _onDone = onDone; _shown = null; _hint = null; _start = Time.unscaledTime; } private void Update() { if (_start < 0f) { return; } float num = Time.unscaledTime - _start; if (_length >= 0f && num >= _length) { Action onDone = _onDone; Stop(); onDone?.Invoke(); return; } string text = null; Step[] steps = _steps; for (int i = 0; i < steps.Length; i++) { Step step = steps[i]; if (num >= step.At) { text = step.Text; } } if (text != null) { if (text != _shown) { _shown = text; _shownAt = Time.unscaledTime; bool flag = text == "DEAL!" || text == "LET'S GO"; Sfx.Type(text.EndsWith(".") ? 0.8f : (flag ? 1.3f : (1f + 0.05f * (float)text.Length))); } Draw(ownText: true); } } public void SetInvite(string invite) { if (!string.IsNullOrEmpty(invite) && invite != _invite) { if (_inviteAlpha <= 0f || _invite == null) { _inviteAt = Time.unscaledTime; _inviteTyped = 0; } _invite = invite; } float num = ((string.IsNullOrEmpty(invite) || _start >= 0f) ? 0f : 1f); _inviteAlpha = Mathf.MoveTowards(_inviteAlpha, num, Time.unscaledDeltaTime * ((num > 0f) ? 10f : 4f)); if (_inviteAlpha <= 0f) { _invite = ((num > 0f) ? _invite : null); if ((Object)(object)_inviteText == (Object)null) { return; } } EnsureCanvas(); ((Component)_inviteText).gameObject.SetActive(_inviteAlpha > 0f && _invite != null); if (_inviteAlpha <= 0f || _invite == null) { return; } ((TMP_Text)_inviteText).text = _invite; int num2 = Mathf.Clamp(Mathf.FloorToInt((Time.unscaledTime - _inviteAt) * 55f), 0, _invite.Length); if (num2 > _inviteTyped) { if (!char.IsWhiteSpace(_invite[num2 - 1])) { Sfx.TypeTick(); } _inviteTyped = num2; } ((TMP_Text)_inviteText).maxVisibleCharacters = num2; ((TMP_Text)_inviteText).alpha = _inviteAlpha; } public void SetPrompt(string prompt) { if (!string.IsNullOrEmpty(prompt)) { _prompt = prompt; } float num = ((string.IsNullOrEmpty(prompt) || _start >= 0f) ? 0f : 1f); _promptAlpha = Mathf.MoveTowards(_promptAlpha, num, Time.unscaledDeltaTime * ((num > 0f) ? 8f : 5f)); if (!(_promptAlpha <= 0f) || !((Object)(object)_promptText == (Object)null)) { EnsureCanvas(); ((Component)_promptText).gameObject.SetActive(_promptAlpha > 0f); if (!(_promptAlpha <= 0f)) { ((TMP_Text)_promptText).text = _prompt; ((TMP_Text)_promptText).alpha = _promptAlpha * (0.85f + 0.15f * Mathf.Sin(Time.unscaledTime * 5f)); } } } private void EnsureCanvas() { //IL_0040: 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) //IL_005e: 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_0077: 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_00c0: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: 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) //IL_0146: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_canvas != (Object)null)) { _canvas = UiKit.CreateCanvas("SkinTradeAnnouncer", 31000, matchHeight: true); _glow = UiKit.Image(UiKit.Rect(((Component)_canvas).transform, "Glow", new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 330f), new Vector2(900f, 300f)), Color.clear, CrtKit.SoftGlow()); ((Graphic)_glow).raycastTarget = false; RectTransform rt = UiKit.Rect(((Component)_canvas).transform, "Text", new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 330f), new Vector2(1400f, 220f)); _text = UiKit.Text(rt, "", 130f, _main, (TextAlignmentOptions)514); ((TMP_Text)_text).extraPadding = true; ((TMP_Text)_text).characterSpacing = 4f; try { ((TMP_Text)_text).outlineWidth = 0.2f; ((TMP_Text)_text).outlineColor = new Color32((byte)28, (byte)12, (byte)0, byte.MaxValue); } catch { } RectTransform rt2 = UiKit.Rect(((Component)_canvas).transform, "Hint", new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 215f), new Vector2(1400f, 60f)); _hintText = UiKit.Text(rt2, "", 38f, UiKit.Yellow, (TextAlignmentOptions)514); ((TMP_Text)_hintText).characterSpacing = 4f; UiKit.SoftShadow((TMP_Text)(object)_hintText); RectTransform rt3 = UiKit.Rect(((Component)_canvas).transform, "Invite", new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 310f), new Vector2(1600f, 200f)); _inviteText = UiKit.Text(rt3, "", 56f, UiKit.Yellow, (TextAlignmentOptions)514); ((TMP_Text)_inviteText).characterSpacing = 4f; ((TMP_Text)_inviteText).lineSpacing = -10f; UiKit.SoftShadow((TMP_Text)(object)_inviteText); ((Component)_inviteText).gameObject.SetActive(false); RectTransform rt4 = UiKit.Rect(((Component)_canvas).transform, "Prompt", new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, -90f), new Vector2(1200f, 50f)); _promptText = UiKit.Text(rt4, "", 32f, UiKit.Yellow, (TextAlignmentOptions)514); ((TMP_Text)_promptText).characterSpacing = 3f; UiKit.SoftShadow((TMP_Text)(object)_promptText); ((Component)_promptText).gameObject.SetActive(false); } } private void Draw(bool ownText) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) if (ownText || !string.IsNullOrEmpty(_hint)) { EnsureCanvas(); } if ((Object)(object)_canvas == (Object)null) { return; } float num = Time.unscaledTime - _shownAt; ((Component)_text).gameObject.SetActive(ownText); if ((Object)(object)_glow != (Object)null) { ((Component)_glow).gameObject.SetActive(ownText); } if (ownText) { float num2 = Mathf.Max(260f, ((TMP_Text)_text).preferredWidth + 260f); ((Graphic)_glow).rectTransform.sizeDelta = new Vector2(num2, 300f); ((Graphic)_glow).color = new Color(_main.r, _main.g, _main.b, 0.38f * Mathf.Clamp01(num / 0.12f + 0.3f)); ((Component)_glow).transform.localScale = Vector3.one * UiKit.Spring(num); ((TMP_Text)_text).text = _shown; ((Graphic)_text).color = ((num < 0.08f) ? _flash : _main); ((TMP_Text)_text).transform.localScale = Vector3.one * UiKit.Spring(num); ((TMP_Text)_text).rectTransform.anchoredPosition = new Vector2(0f, 330f + 14f * Mathf.Exp(-10f * num) * Mathf.Sin(45f * num)); ((Graphic)_glow).rectTransform.anchoredPosition = ((TMP_Text)_text).rectTransform.anchoredPosition; } bool flag = !string.IsNullOrEmpty(_hint); ((Component)_hintText).gameObject.SetActive(flag); if (!flag) { return; } ((TMP_Text)_hintText).text = _hint; int num3 = Mathf.Clamp(Mathf.FloorToInt((Time.unscaledTime - _hintAt) * 45f), 0, _hint.Length); if (num3 > _hintTyped) { if (!char.IsWhiteSpace(_hint[num3 - 1])) { Sfx.TypeTick(); } _hintTyped = num3; } ((TMP_Text)_hintText).maxVisibleCharacters = num3; ((TMP_Text)_hintText).alpha = ((num3 < _hint.Length) ? 1f : (0.75f + 0.25f * Mathf.Sin(Time.unscaledTime * 4f))); } } internal static class GameBridge { public enum LookPart { None, RightHand, LeftHand, Body } private struct Arm { public Vector3 Shoulder; public Vector3 Hand; } private const BindingFlags All = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private static readonly Dictionary _types = new Dictionary(); private static bool _resolved; private static bool _ok; private static Type _metaType; private static FieldInfo _saveReady; private static FieldInfo _unlocks; private static FieldInfo _equipped; private static FieldInfo _assets; private static FieldInfo _tokens; private static MethodInfo _save; private static MethodInfo _updateLocal; private static HashSet _excluded; private static MethodInfo _toUnequip; private static bool _toUnequipResolved; private static readonly string[] DefaultRarityNames = new string[4] { "COMMON", "UNCOMMON", "RARE", "ULTRA RARE" }; private static readonly Color[] RarityColors = (Color[])(object)new Color[4] { new Color(0.35f, 0.95f, 0.35f), new Color(0.3f, 0.65f, 1f), new Color(1f, 0.4f, 0.85f), new Color(1f, 0.8f, 0.15f) }; private static Type _rarityEnum; private static Type _tokenElementType = typeof(int); private static MethodInfo _runIsShop; private static bool _shopResolved; private static MethodInfo _runIsLevel; private static bool _levelResolved; private static bool _truckWarned; private static Component _localAvatar; private static float _localAvatarAt = -9f; private static int _lookFrame = -1; private static int _lookActor; private static LookPart _lookPart; private static bool _handsWarned; private const float HandTolerance = 0.32f; private static Type _leftArmType; private const float ArmTolerance = 0.24f; private static MethodInfo _poseOverride; public static readonly string[] Categories = new string[4] { "HEAD", "BODY", "ARMS", "LEGS" }; private static readonly Dictionary _category = new Dictionary(); private static float _avatarScanAt = -9f; private static Type _avatarType; private static readonly Dictionary _avatars = new Dictionary(); private static MethodInfo _bigMessage; private static bool _bigResolved; private static TMP_FontAsset _font; private static bool _diagDone; private static bool _disabledByUs; private static AudioMixerGroup _sfxGroup; private static float _nextMixerLookup; private static Type _inputKeyType; private static Type _rumbleType; private static MethodInfo _keyDown; private static MethodInfo _keyHold; private static MethodInfo _keyString; private static MethodInfo _rumble; private static MethodInfo _deviceType; private static List _monsterNames; private static float _monsterScanAt = -99f; private static FieldInfo _currentPage; public static string Problem { get; private set; } private static object Meta { get { if (!Resolve()) { return null; } return StaticInstance(_metaType); } } public static bool Ready { get { object meta = Meta; if (meta == null) { return false; } if (_saveReady != null && _saveReady.FieldType == typeof(bool) && !(bool)_saveReady.GetValue(meta)) { return false; } if (Unlocks != null) { return Assets != null; } return false; } } public static List Unlocks { get { if (Meta != null) { return _unlocks.GetValue(Meta) as List; } return null; } } private static List Equipped { get { if (Meta != null && !(_equipped == null)) { return _equipped.GetValue(Meta) as List; } return null; } } private static IList Assets { get { if (Meta != null) { return _assets.GetValue(Meta) as IList; } return null; } } private static IList Tokens { get { if (Meta != null && !(_tokens == null)) { return _tokens.GetValue(Meta) as IList; } return null; } } public static bool TokensAvailable => Tokens != null; public static int AssetCount => Assets?.Count ?? 0; public static List RarityValues { get; private set; } = new List { 0, 1, 2, 3 }; public static LookPart LookPartNow { get { LookTargetActor(); return _lookPart; } } internal static Type FindType(string name) { if (_types.TryGetValue(name, out var value)) { return value; } Type type = null; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { try { type = assembly.GetType(name, throwOnError: false); } catch { } if (type != null) { break; } } _types[name] = type; return type; } private static object StaticInstance(Type t) { if (t == null) { return null; } object obj = null; FieldInfo fieldInfo = t.GetField("instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) ?? t.GetField("Instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (fieldInfo != null) { obj = fieldInfo.GetValue(null); } else { PropertyInfo propertyInfo = t.GetProperty("instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) ?? t.GetProperty("Instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (propertyInfo != null) { obj = propertyInfo.GetValue(null); } } if (!Alive(obj)) { return null; } return obj; } private static bool Alive(object o) { if (o != null) { Object val = (Object)((o is Object) ? o : null); if (val != null) { return !(val == (Object)null); } return true; } return false; } private static object Get(object inst, string member) { if (inst == null) { return null; } Type type = inst.GetType(); FieldInfo field = type.GetField(member, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field.GetValue(inst); } return type.GetProperty(member, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(inst); } private static bool Resolve() { if (_resolved) { return _ok; } _resolved = true; _metaType = FindType("MetaManager"); if (_metaType == null) { return Fail("Type MetaManager not found (game version not supported)."); } _saveReady = _metaType.GetField("saveReady", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _unlocks = _metaType.GetField("cosmeticUnlocks", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _equipped = _metaType.GetField("cosmeticEquipped", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _assets = _metaType.GetField("cosmeticAssets", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _tokens = _metaType.GetField("cosmeticTokens", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _save = _metaType.GetMethod("Save", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); _updateLocal = _metaType.GetMethod("CosmeticPlayerUpdateLocal", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (_unlocks == null || _unlocks.FieldType != typeof(List)) { return Fail("MetaManager.cosmeticUnlocks not found."); } if (_assets == null) { return Fail("MetaManager.cosmeticAssets not found."); } if (_save == null) { return Fail("MetaManager.Save() not found."); } if (_tokens == null || !typeof(IList).IsAssignableFrom(_tokens.FieldType)) { Plugin.Log.LogWarning((object)"MetaManager.cosmeticTokens not found - coins can't be traded."); } ResolveRarities(); _ok = true; Plugin.Log.LogInfo((object)"Cosmetic data found - trading available."); return true; } private static bool Fail(string msg) { Problem = msg; Plugin.Log.LogError((object)msg); _ok = false; return false; } public static bool Owns(int id) { if (Unlocks != null) { return Unlocks.Contains(id); } return false; } public static bool IsTradeable(int id) { if (id < 0 || id >= AssetCount) { return false; } if (_excluded == null) { _excluded = new HashSet(); string[] array = (Plugin.ExcludedCosmeticIds.Value ?? "").Split(','); for (int i = 0; i < array.Length; i++) { if (int.TryParse(array[i].Trim(), out var result)) { _excluded.Add(result); } } } return !_excluded.Contains(id); } private static object Asset(int id) { IList assets = Assets; if (assets != null && id >= 0 && id < assets.Count) { return assets[id]; } return null; } public static object AssetObject(int id) { return Asset(id); } public static string AssetKey(int id) { object obj = Asset(id); Object val = (Object)((obj is Object) ? obj : null); if (val == null || !(val != (Object)null)) { return ""; } return val.name; } public static string DisplayName(int id) { object obj = Asset(id); if (obj == null) { return "#" + id; } string text = Get(obj, "assetName") as string; if (!string.IsNullOrEmpty(text)) { return text; } return AssetKey(id); } public static int AssetRarity(int id) { object obj = Get(Asset(id), "rarity"); try { return (obj != null) ? Convert.ToInt32(obj) : 0; } catch { return 0; } } public static List EquippedList() { if (Equipped != null) { return new List(Equipped); } return new List(); } public static int[] EquippedColors() { try { return Meta?.GetType().GetField("colorsEquipped", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(Meta) as int[]; } catch { return null; } } public static int[] TryOnColors(IEnumerable loadout, IEnumerable received) { int[] array = EquippedColors(); if (array == null) { return null; } int[] array2 = (int[])array.Clone(); try { IList list = Meta?.GetType().GetField("colors", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(Meta) as IList; HashSet hashSet = new HashSet(loadout); foreach (int item in received) { if (hashSet.Contains(item)) { int num = AssetTypeIndex(item); if (num >= 0 && num < array2.Length) { object obj = Get(Asset(item), "defaultColor"); Object val = (Object)((obj is Object) ? obj : null); int num2 = ((val != (Object)null && list != null) ? list.IndexOf(val) : 0); array2[num] = ((num2 >= 0) ? num2 : 0); } } } } catch { } return array2; } public static int AssetTypeIndex(int id) { object obj = Get(Asset(id), "type"); try { return (obj == null) ? (-1) : Convert.ToInt32(obj); } catch { return -1; } } public static bool TypeAllowsMultiple(int typeIndex) { try { if (!(Meta?.GetType().GetField("cosmeticTypeAssets", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(Meta) is IList list) || typeIndex < 0 || typeIndex >= list.Count || list[typeIndex] == null) { return false; } object obj = Get(list[typeIndex], "canEquipMultiple"); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } catch { return false; } } public static List TryOnLoadout(IEnumerable give, IEnumerable get) { List list = EquippedList(); HashSet hashSet = new HashSet(give); list.RemoveAll(hashSet.Contains); foreach (int item in get) { HashSet hashSet2 = GameConflicts(list, item); if (hashSet2 != null) { list.RemoveAll(hashSet2.Contains); } else { int type = AssetTypeIndex(item); if (type >= 0 && !TypeAllowsMultiple(type)) { list.RemoveAll((int x) => AssetTypeIndex(x) == type); } } if (!list.Contains(item)) { list.Add(item); } } return list; } private static HashSet GameConflicts(List equipped, int id) { try { object meta = Meta; object obj = Asset(id); if (meta == null || obj == null) { return null; } if (!_toUnequipResolved) { _toUnequipResolved = true; _toUnequip = meta.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo m) => m.Name == "GetCosmeticsToUnequip" && m.GetParameters().Length == 2 && m.GetParameters()[0].ParameterType == typeof(List)); if (_toUnequip == null) { Plugin.Log.LogWarning((object)"MetaManager.GetCosmeticsToUnequip not found - try-on uses a simple slot check."); } } if (_toUnequip == null) { return null; } if (!(_toUnequip.Invoke(meta, new object[2] { new List(equipped), obj }) is IEnumerable enumerable)) { return null; } IList assets = Assets; HashSet hashSet = new HashSet(); foreach (object item2 in enumerable) { if (item2 is int item) { hashSet.Add(item); continue; } int num = assets?.IndexOf(item2) ?? (-1); if (num >= 0) { hashSet.Add(num); } } return hashSet; } catch { return null; } } private static void ResolveRarities() { if (_tokens != null && _tokens.FieldType.IsGenericType) { _tokenElementType = _tokens.FieldType.GetGenericArguments()[0]; } Type type = _assets?.FieldType; FieldInfo fieldInfo = ((type == null) ? null : (type.IsArray ? type.GetElementType() : (type.IsGenericType ? type.GetGenericArguments()[0] : null)))?.GetField("rarity", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (_tokenElementType.IsEnum) { _rarityEnum = _tokenElementType; } else if (fieldInfo != null && fieldInfo.FieldType.IsEnum) { _rarityEnum = fieldInfo.FieldType; } if (_rarityEnum != null) { RarityValues = (from v in (from object v in Enum.GetValues(_rarityEnum) where !string.Equals(Enum.GetName(_rarityEnum, v), "None", StringComparison.OrdinalIgnoreCase) select Convert.ToInt32(v)).Distinct() orderby v select v).ToList(); } } public static int RarityIndex(int value) { return RarityValues.IndexOf(value); } public static string RarityName(int value) { if (_rarityEnum != null) { string name = Enum.GetName(_rarityEnum, Enum.ToObject(_rarityEnum, value)); if (!string.IsNullOrEmpty(name)) { return Regex.Replace(name, "([a-z])([A-Z])", "$1 $2").ToUpperInvariant(); } } int num = RarityIndex(value); if (num < 0 || num >= DefaultRarityNames.Length) { return "RARITY " + value; } return DefaultRarityNames[num]; } public static Color RarityColor(int value) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Clamp(RarityIndex(value), 0, RarityColors.Length - 1); return RarityColors[num]; } public static int[] TokenCounts() { int[] array = new int[RarityValues.Count]; IList tokens = Tokens; if (tokens == null) { return array; } foreach (object item in tokens) { int num; try { num = RarityIndex(Convert.ToInt32(item)); } catch { continue; } if (num >= 0) { array[num]++; } } return array; } private static object MakeToken(int rarityValue) { if (!_tokenElementType.IsEnum) { return Convert.ChangeType(rarityValue, _tokenElementType); } return Enum.ToObject(_tokenElementType, rarityValue); } public static bool ApplyDeal(ICollection giveSkins, ICollection getSkins, int[] giveTokens, int[] getTokens, out string error) { return ApplyChanges(giveSkins, getSkins, giveTokens, getTokens, out error); } public static bool Escrow(ICollection giveSkins, int[] giveTokens, out string error) { return ApplyChanges(giveSkins, Array.Empty(), giveTokens, null, out error); } public static bool AddItems(ICollection skins, int[] tokens, out string error) { return ApplyChanges(Array.Empty(), skins, null, tokens, out error); } private static bool ApplyChanges(ICollection removeSkins, ICollection addSkins, int[] removeTokens, int[] addTokens, out string error) { if (!CanGive(removeSkins, removeTokens, out error)) { return false; } List unlocks = Unlocks; IList tokens = Tokens; try { foreach (int id in removeSkins) { unlocks.RemoveAll((int x) => x == id); Equipped?.RemoveAll((int x) => x == id); } foreach (int addSkin in addSkins) { if (addSkin >= 0 && addSkin < AssetCount && !unlocks.Contains(addSkin)) { unlocks.Add(addSkin); } } try { if (addSkins.Count > 0 && Meta.GetType().GetField("cosmeticHistory", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(Meta) is IList list) { foreach (int addSkin2 in addSkins) { while (list.Contains(addSkin2)) { list.Remove(addSkin2); } } } } catch { } if (tokens != null) { for (int num = 0; num < RarityValues.Count; num++) { int num2 = RarityValues[num]; for (int num3 = 0; num3 < At(removeTokens, num); num3++) { for (int num4 = tokens.Count - 1; num4 >= 0; num4--) { if (Convert.ToInt32(tokens[num4]) == num2) { tokens.RemoveAt(num4); break; } } } for (int num5 = 0; num5 < At(addTokens, num); num5++) { tokens.Add(MakeToken(num2)); } } } _save.Invoke(Meta, null); RefreshAvatar(); return true; } catch (Exception ex) { error = ex.GetBaseException().Message; Plugin.Log.LogError((object)("Changing cosmetics failed: " + ex)); return false; } } public static int IdOfKey(string key) { for (int i = 0; i < AssetCount; i++) { if (AssetKey(i) == key) { return i; } } return -1; } public static bool CanGive(ICollection giveSkins, int[] giveTokens, out string error) { error = null; if (!Ready) { error = "save data not ready"; return false; } foreach (int giveSkin in giveSkins) { if (!Owns(giveSkin) || !IsTradeable(giveSkin)) { error = "you no longer own " + DisplayName(giveSkin); return false; } } int[] array = TokenCounts(); for (int i = 0; i < array.Length; i++) { if (At(giveTokens, i) > array[i]) { error = "not enough coins"; return false; } } if (giveTokens != null && giveTokens.Any((int c) => c > 0) && Tokens == null) { error = "coins not supported"; return false; } return true; } private static int At(int[] a, int i) { if (a == null || i >= a.Length) { return 0; } return Math.Max(0, a[i]); } private static void RefreshAvatar() { if (_updateLocal == null) { return; } try { ParameterInfo[] parameters = _updateLocal.GetParameters(); object[] array = new object[parameters.Length]; for (int i = 0; i < parameters.Length; i++) { array[i] = ((parameters[i].ParameterType == typeof(bool)) ? ((object)true) : (parameters[i].ParameterType.IsValueType ? Activator.CreateInstance(parameters[i].ParameterType) : null)); } _updateLocal.Invoke(Meta, array); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Avatar refresh failed (cosmetics update after the next level load): " + ex.GetBaseException().Message)); } } public static bool InShop() { if (!_shopResolved) { _shopResolved = true; _runIsShop = FindType("SemiFunc")?.GetMethod("RunIsShop", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); if (_runIsShop == null) { Plugin.Log.LogWarning((object)"SemiFunc.RunIsShop not found - using RunManager fallback."); } } try { if (_runIsShop != null) { return (bool)_runIsShop.Invoke(null, null); } object inst = StaticInstance(FindType("RunManager")); object obj = Get(inst, "levelCurrent"); object obj2 = Get(inst, "levelShop"); if (obj == null || obj2 == null) { return false; } if (obj2 is IList list) { return list.Contains(obj); } return obj2 == obj || obj2.Equals(obj); } catch { return false; } } public static bool RunIsLevel() { if (!_levelResolved) { _levelResolved = true; _runIsLevel = FindType("SemiFunc")?.GetMethod("RunIsLevel", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); if (_runIsLevel == null) { Plugin.Log.LogWarning((object)"SemiFunc.RunIsLevel not found - trading is allowed everywhere."); } } try { return _runIsLevel != null && (bool)_runIsLevel.Invoke(null, null); } catch { return false; } } public static bool LocalInTruck() { try { Component val = LocalAvatar(); if ((Object)(object)val == (Object)null) { return true; } object obj = Get(val, "RoomVolumeCheck") ?? Get(val, "roomVolumeCheck"); if (obj == null) { Type type = FindType("RoomVolumeCheck"); if (type != null) { obj = val.GetComponentInChildren(type); } } if (Get(obj, "inTruck") is bool result) { return result; } } catch { } if (!_truckWarned) { _truckWarned = true; Plugin.Log.LogWarning((object)"Truck detection not available - trading in levels is allowed everywhere."); } return true; } public static bool CanTradeHere() { if (RunIsLevel()) { return LocalInTruck(); } return true; } public static object LevelToken() { try { return Get(StaticInstance(FindType("RunManager")), "levelCurrent"); } catch { return null; } } public static string GameStateToken() { try { return Get(StaticInstance(FindType("GameDirector")), "currentState")?.ToString() ?? ""; } catch { return ""; } } private static Component LocalAvatar() { if ((Object)(object)_localAvatar != (Object)null && Time.unscaledTime - _localAvatarAt < 2f) { return _localAvatar; } _localAvatarAt = Time.unscaledTime; _localAvatar = null; Type type = FindType("PlayerAvatar"); if (type == null) { return null; } object obj = StaticInstance(type); Component val = (Component)((obj is Component) ? obj : null); if (val != null && (Object)(object)val != (Object)null) { return _localAvatar = val; } Object[] array = Object.FindObjectsByType(type, (FindObjectsSortMode)0); foreach (Object obj2 in array) { Component val2 = (Component)(object)((obj2 is Component) ? obj2 : null); if (val2 != null && (Object)(object)val2 != (Object)null) { PhotonView component = val2.GetComponent(); if (component != null && component.IsMine) { return _localAvatar = val2; } } } return null; } public static int LocalGrabTargetActor() { try { if (!GameKeyHeld("Grab")) { return 0; } int num = LookTargetActor(); if (_lookPart != LookPart.RightHand || !HandshakePoseOk(num)) { return 0; } return num; } catch { return 0; } } public static bool LocalPhysGrabbing() { try { object obj = StaticInstance(FindType("PhysGrabber")); bool flag = default(bool); int num; if (obj != null) { object obj2 = Get(obj, "grabbed"); if (obj2 is bool) { flag = (bool)obj2; num = 1; } else { num = 0; } } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } catch { return false; } } public static bool IsTumbling(int actor) { try { Transform val = AvatarOf(actor); if ((Object)(object)val == (Object)null || _avatarType == null) { return false; } Component component = ((Component)val).GetComponent(_avatarType); bool flag = default(bool); int num; if ((Object)(object)component != (Object)null) { object obj = Get(component, "isTumbling"); if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } catch { return false; } } public static bool LocalPoseOk() { if (LocalPhysGrabbing()) { return false; } int num = ((PhotonNetwork.LocalPlayer != null) ? PhotonNetwork.LocalPlayer.ActorNumber : 0); if (num != 0) { return !IsTumbling(num); } return true; } public static bool HandshakePoseOk(int other) { if (!LocalPoseOk()) { return false; } if (other == 0) { return true; } try { Room currentRoom = PhotonNetwork.CurrentRoom; Player val = ((currentRoom != null) ? currentRoom.GetPlayer(other, false) : null); bool flag = default(bool); int num; if (val != null) { object obj = val.CustomProperties[(object)"skintrade.busy"]; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { return false; } } catch { } return true; } public static int LookTargetActor() { //IL_0090: 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_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) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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) //IL_015b: 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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_01da: Unknown result type (might be due to invalid IL or missing references) if (_lookFrame == Time.frameCount) { return _lookActor; } _lookFrame = Time.frameCount; _lookActor = 0; _lookPart = LookPart.None; try { Component val = LocalAvatar(); if ((Object)(object)val == (Object)null || IsOut(val)) { return 0; } object obj = Get(val, "localCamera"); Camera val2 = (Camera)((obj is Camera) ? obj : null); if ((Object)(object)val2 == (Object)null) { val2 = Camera.main; } if ((Object)(object)val2 == (Object)null) { return 0; } AvatarOf(0); int actorNumber = PhotonNetwork.LocalPlayer.ActorNumber; Vector3 position = ((Component)val2).transform.position; Vector3 forward = ((Component)val2).transform.forward; float num = Plugin.MaxDistance.Value * 1.3f + 0.6f; int lookActor = 0; LookPart lookPart = LookPart.None; float num2 = float.MaxValue; foreach (KeyValuePair avatar in _avatars) { if (avatar.Key == actorNumber || (Object)(object)avatar.Value == (Object)null) { continue; } Component component = ((Component)avatar.Value).GetComponent(_avatarType); if ((Object)(object)component == (Object)null || IsOut(component)) { continue; } Vector3 a = avatar.Value.position + Vector3.up * 0.25f; Vector3 b = avatar.Value.position + Vector3.up * 1.7f; ClosestRaySegment(position, forward, a, b, out var along, out var gap); if (along <= 0.05f || along > num || gap > 0.6f) { continue; } LookPart lookPart2 = ((gap <= 0.5f) ? LookPart.Body : LookPart.None); float num3 = gap + along * 0.05f; if (Arms(component, out var right, out var left)) { float num4 = ArmScore(position, forward, right, num); float num5 = ArmScore(position, forward, left, num); float num6 = Mathf.Min(num4, num5); if (num6 <= 1f) { lookPart2 = ((num4 <= num5) ? LookPart.RightHand : LookPart.LeftHand); num3 = num6 * 0.15f + along * 0.05f; } } else { if (!_handsWarned) { _handsWarned = true; Plugin.Log.LogWarning((object)"Player hands not found - the whole body counts as the right hand."); } if (lookPart2 == LookPart.Body) { lookPart2 = LookPart.RightHand; } } if (lookPart2 != LookPart.None && num3 < num2) { num2 = num3; lookActor = avatar.Key; lookPart = lookPart2; } } _lookPart = lookPart; return _lookActor = lookActor; } catch { return 0; } } private static float RayPointGap(Vector3 o, Vector3 d, Vector3 p, float reach) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //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_0020: 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_0028: 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) float num = Vector3.Dot(p - o, d); if (num <= 0.05f || num > reach) { return float.MaxValue; } return Vector3.Distance(o + d * num, p); } private static bool Arms(Component avatar, out Arm right, out Arm left) { //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_0072: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_008d: 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_00b7: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) right = default(Arm); left = default(Arm); object obj = Get(avatar, "playerAvatarVisuals"); Component val = (Component)((obj is Component) ? obj : null); object inst = Get(val, "playerAvatarRightArm"); object obj2 = Get(inst, "grabberTransform"); Transform val2 = (Transform)((obj2 is Transform) ? obj2 : null); object obj3 = Get(inst, "rightArmTransform"); Transform val3 = (Transform)((obj3 is Transform) ? obj3 : null); if ((Object)(object)val2 == (Object)null && (Object)(object)val3 == (Object)null) { return false; } Vector3 up = avatar.transform.up; right.Hand = (val2 ?? val3).position; right.Shoulder = (((Object)(object)val3 != (Object)null && Vector3.Distance(val3.position, right.Hand) > 0.15f) ? val3.position : (right.Hand + up * 0.45f)); if (_leftArmType == null) { _leftArmType = FindType("PlayerAvatarLeftArm"); } Component inst2 = (((Object)(object)val != (Object)null && _leftArmType != null) ? val.GetComponentInChildren(_leftArmType) : null); object obj4 = Get(inst2, "flashlightController"); Component val4 = (Component)((obj4 is Component) ? obj4 : null); object obj5 = Get(inst2, "leftArmTransform"); Transform val5 = (Transform)((obj5 is Transform) ? obj5 : null); Vector3 position = avatar.transform.position; Vector3 right2 = avatar.transform.right; if ((Object)(object)val4 != (Object)null) { left.Hand = val4.transform.position; } else { left.Hand = right.Hand - right2 * (2f * Vector3.Dot(right.Hand - position, right2)); } left.Shoulder = (((Object)(object)val5 != (Object)null && Vector3.Distance(val5.position, left.Hand) > 0.15f) ? val5.position : (right.Shoulder - right2 * (2f * Vector3.Dot(right.Shoulder - position, right2)))); return true; } private static float ArmScore(Vector3 o, Vector3 d, Arm a, float reach) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0032: 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) ClosestRaySegment(o, d, a.Shoulder, a.Hand, out var along, out var gap); float num = ((along <= 0.05f || along > reach) ? float.MaxValue : (gap / 0.24f)); float num2 = RayPointGap(o, d, a.Hand, reach) / 0.32f; return Mathf.Min(num, num2); } private static void ClosestRaySegment(Vector3 o, Vector3 d, Vector3 a, Vector3 b, out float along, out float gap) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_001f: 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_0027: 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_0056: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_006a: 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_0070: 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) //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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) Vector3 val = b - a; Vector3 val2 = o - a; float num = Vector3.Dot(val, val); float num2 = Vector3.Dot(val, d); float num3 = Vector3.Dot(val, val2); float num4 = Vector3.Dot(d, val2); float num5 = num - num2 * num2; float num6 = ((num5 > 1E-05f) ? Mathf.Clamp01((num3 - num2 * num4) / num5) : 0f); Vector3 val3 = a + val * num6; along = Vector3.Dot(val3 - o, d); Vector3 val4 = o + d * Mathf.Max(0f, along); gap = Vector3.Distance(val4, val3); } private static bool IsOut(Component avatar) { object obj = Get(avatar, "isDisabled"); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) == 0) { obj = Get(avatar, "deadSet"); bool flag2 = default(bool); int num2; if (obj is bool) { flag2 = (bool)obj; num2 = 1; } else { num2 = 0; } return (byte)((uint)num2 & (flag2 ? 1u : 0u)) != 0; } return true; } public static void ReachPose(int actor) { try { Transform val = AvatarOf(actor); if ((Object)(object)val == (Object)null || _avatarType == null) { return; } Component component = ((Component)val).GetComponent(_avatarType); if ((Object)(object)component == (Object)null || IsOut(component)) { return; } object obj = Get(Get(component, "playerAvatarVisuals"), "playerAvatarRightArm"); if (obj != null) { if (_poseOverride == null) { _poseOverride = obj.GetType().GetMethod("GrabberPoseOverride", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(float) }, null); } _poseOverride?.Invoke(obj, new object[1] { 0.2f }); } } catch { } } public static string Category(int id) { if (_category.TryGetValue(id, out var value)) { return value; } value = ""; try { object obj = Asset(id); List list = new List(); object obj2 = Get(obj, "type"); IList list2 = Get(Meta, "cosmeticTypeAssets") as IList; int num = -1; try { if (obj2 != null) { num = Convert.ToInt32(obj2); } } catch { } if (list2 != null && num >= 0 && num < list2.Count) { object? obj4 = list2[num]; Object val = (Object)((obj4 is Object) ? obj4 : null); if (val != null && val != (Object)null) { list.Add(val.name); FieldInfo[] fields = ((object)val).GetType().GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { object obj5 = (fieldInfo.IsStatic ? null : fieldInfo.GetValue(val)); Object val2 = (Object)((obj5 is Object) ? obj5 : null); if (val2 != null && val2 != (Object)null && ((object)val2).GetType().Name.IndexOf("Category", StringComparison.OrdinalIgnoreCase) >= 0) { list.Insert(0, val2.name); if (Get(val2, "assetName") is string item) { list.Insert(0, item); } } else if (obj5 is string item2 && fieldInfo.Name.IndexOf("name", StringComparison.OrdinalIgnoreCase) >= 0) { list.Add(item2); } } } } Object val3 = (Object)((obj is Object) ? obj : null); if (val3 != null && val3 != (Object)null) { list.Add(val3.name); } value = Classify(list); } catch { } return _category[id] = value; } private static string Classify(IEnumerable words) { foreach (string word in words) { if (string.IsNullOrEmpty(word)) { continue; } string text = word.ToLowerInvariant(); string[] categories = Categories; foreach (string text2 in categories) { if (text.Contains(text2.ToLowerInvariant())) { return text2; } } if (text.Contains("hat") || text.Contains("eye") || text.Contains("face") || text.Contains("mouth") || text.Contains("ear") || text.Contains("hair") || text.Contains("glass") || text.Contains("mask")) { return "HEAD"; } if (text.Contains("arm") || text.Contains("hand") || text.Contains("glove") || text.Contains("wrist")) { return "ARMS"; } if (text.Contains("leg") || text.Contains("foot") || text.Contains("feet") || text.Contains("shoe") || text.Contains("pant") || text.Contains("boot")) { return "LEGS"; } if (text.Contains("body") || text.Contains("top") || text.Contains("chest") || text.Contains("jacket") || text.Contains("shirt") || text.Contains("back") || text.Contains("neck")) { return "BODY"; } } return ""; } public static Transform AvatarOf(int actor) { if (Time.unscaledTime - _avatarScanAt > 2f) { _avatarScanAt = Time.unscaledTime; _avatars.Clear(); Type type = (_avatarType = FindType("PlayerAvatar")); if (type != null) { Object[] array = Object.FindObjectsByType(type, (FindObjectsSortMode)0); foreach (Object obj in array) { Component val = (Component)(object)((obj is Component) ? obj : null); if (val != null && !((Object)(object)val == (Object)null)) { PhotonView val2 = (PhotonView)(((object)val.GetComponent()) ?? ((object)/*isinst with value type is only supported in some contexts*/)); if (((val2 != null) ? val2.Owner : null) != null) { _avatars[val2.Owner.ActorNumber] = val.transform; } } } } } if (!_avatars.TryGetValue(actor, out var value) || !((Object)(object)value != (Object)null)) { return null; } return value; } public static float DistanceTo(int actor) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) Transform val = ((PhotonNetwork.LocalPlayer != null) ? AvatarOf(PhotonNetwork.LocalPlayer.ActorNumber) : null); Transform val2 = AvatarOf(actor); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { return -1f; } Vector3 val3 = val2.position - val.position; val3.y = 0f; return ((Vector3)(ref val3)).magnitude; } public static bool BigMessage(string text, Color main, Color flash, float size) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) Type type = FindType("BigMessageUI"); if (!_bigResolved) { _bigResolved = true; _bigMessage = type?.GetMethod("BigMessage", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[5] { typeof(string), typeof(string), typeof(float), typeof(Color), typeof(Color) }, null); if (_bigMessage == null) { Plugin.Log.LogWarning((object)"BigMessageUI.BigMessage not found - using own text overlay."); } } if (_bigMessage == null) { return false; } object obj = StaticInstance(type); if (obj == null) { return false; } try { _bigMessage.Invoke(obj, new object[5] { text, "", size, main, flash }); return true; } catch { _bigMessage = null; return false; } } public static TMP_FontAsset GameFont() { if ((Object)(object)_font != (Object)null) { return _font; } try { object obj = Get(StaticInstance(FindType("BigMessageUI")), "Text"); TMP_Text val = (TMP_Text)((obj is TMP_Text) ? obj : null); if (val != null && (Object)(object)val.font != (Object)null) { return _font = val.font; } } catch { } TextMeshProUGUI val2 = ((IEnumerable)Object.FindObjectsByType((FindObjectsSortMode)0)).FirstOrDefault((Func)((TextMeshProUGUI x) => (Object)(object)((TMP_Text)x).font != (Object)null)); if ((Object)(object)val2 != (Object)null) { return _font = ((TMP_Text)val2).font; } return _font = Resources.FindObjectsOfTypeAll().FirstOrDefault(); } public static TMP_FontAsset TitleFont() { TMP_FontAsset[] source = Resources.FindObjectsOfTypeAll(); string wanted = (Plugin.TitleFontName.Value ?? "").Trim(); TMP_FontAsset val = null; if (wanted.Length > 0) { val = ((IEnumerable)source).FirstOrDefault((Func)((TMP_FontAsset f) => ((Object)f).name.IndexOf(wanted, StringComparison.OrdinalIgnoreCase) >= 0)); } if ((Object)(object)val == (Object)null) { val = ((IEnumerable)source).FirstOrDefault((Func)((TMP_FontAsset f) => new string[3] { "logo", "title", "header" }.Any((string k) => ((Object)f).name.IndexOf(k, StringComparison.OrdinalIgnoreCase) >= 0))); } return val ?? GameFont(); } public static void LogDiagnosticsOnce() { if (_diagDone || !Plugin.Diagnostics.Value || !Ready) { return; } _diagDone = true; try { IOrderedEnumerable values = from n in (from f in Resources.FindObjectsOfTypeAll() select ((Object)f).name).Distinct() orderby n select n; ManualLogSource log = Plugin.Log; string[] obj = new string[7] { "[Diagnostics] TMP fonts: ", string.Join(", ", values), " (body font: ", null, null, null, null }; TMP_FontAsset obj2 = GameFont(); obj[3] = ((obj2 != null) ? ((Object)obj2).name : null); obj[4] = ", title font: "; TMP_FontAsset obj3 = TitleFont(); obj[5] = ((obj3 != null) ? ((Object)obj3).name : null); obj[6] = ")"; log.LogInfo((object)string.Concat(obj)); object obj4 = Asset(0) ?? Asset(1); if (obj4 != null) { List list = new List(); Type type = obj4.GetType(); while (type != null && type != typeof(ScriptableObject) && type != typeof(object)) { FieldInfo[] fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (!fieldInfo.IsStatic) { list.Add(fieldInfo.Name + ":" + fieldInfo.FieldType.Name); } } type = type.BaseType; } Plugin.Log.LogInfo((object)("[Diagnostics] " + obj4.GetType().Name + " fields: " + string.Join(", ", list))); } Plugin.Log.LogInfo((object)string.Format("[Diagnostics] cosmetics: {0}, rarities: {1}, tokens: {2}", AssetCount, string.Join("/", RarityValues.Select(RarityName)), TokensAvailable ? "ok" : "missing")); } catch (Exception ex) { Plugin.Log.LogWarning((object)("[Diagnostics] failed: " + ex.Message)); } } public static void SetGameInputBlocked(bool blocked) { try { object obj = StaticInstance(FindType("GameDirector")); if (obj != null) { Type type = obj.GetType(); if (blocked) { MethodInfo method = type.GetMethod("SetDisableInput", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(float) }, null); if (method != null) { method.Invoke(obj, new object[1] { 0.25f }); } else { type.GetField("DisableInput", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(obj, true); } MethodInfo method2 = type.GetMethod("SetDisableEscMenu", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(float) }, null); if (method2 != null) { method2.Invoke(obj, new object[1] { 0.3f }); } else { type.GetField("disableEscMenuTimer", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(obj, 0.3f); } _disabledByUs = true; } else if (_disabledByUs) { type.GetField("DisableInputTimer", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(obj, 0f); type.GetField("DisableInput", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(obj, false); _disabledByUs = false; } } } catch { } if (!blocked) { return; } try { object obj3 = StaticInstance(FindType("PlayerController")); obj3?.GetType().GetMethod("InputDisable", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(float) }, null)?.Invoke(obj3, new object[1] { 0.25f }); } catch { } } private static void Set(FieldInfo f, PropertyInfo p, object inst, bool value) { if (f != null) { f.SetValue(inst, value); } else if (p != null && p.CanWrite) { p.SetValue(inst, value); } } internal static AudioMixerGroup SfxMixerGroup() { if ((Object)(object)_sfxGroup != (Object)null) { return _sfxGroup; } if (Time.unscaledTime < _nextMixerLookup) { return null; } _nextMixerLookup = Time.unscaledTime + 3f; try { Type type = FindType("AudioManager"); object obj = ((type != null) ? StaticInstance(type) : null); if (obj == null) { return null; } List> list = new List>(); FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (typeof(AudioMixerGroup).IsAssignableFrom(fieldInfo.FieldType)) { object? value = fieldInfo.GetValue(obj); AudioMixerGroup val = (AudioMixerGroup)((value is AudioMixerGroup) ? value : null); if (val != null && (Object)(object)val != (Object)null) { list.Add(new KeyValuePair(fieldInfo.Name, val)); } } } if (list.Count == 0) { return null; } string wanted = (Plugin.SoundMixerGroup.Value ?? "").Trim(); AudioMixerGroup val2 = null; if (wanted.Length > 0 && !wanted.Equals("auto", StringComparison.OrdinalIgnoreCase)) { val2 = list.FirstOrDefault((KeyValuePair kv) => kv.Key.Equals(wanted, StringComparison.OrdinalIgnoreCase) || ((Object)kv.Value).name.Equals(wanted, StringComparison.OrdinalIgnoreCase)).Value; } if ((Object)(object)val2 == (Object)null) { val2 = list.FirstOrDefault((KeyValuePair kv) => L(kv.Key).Contains("soundmaster") || L(((Object)kv.Value).name) == "sound").Value ?? list.FirstOrDefault((KeyValuePair kv) => L(kv.Key).Contains("persistent")).Value ?? list.FirstOrDefault((KeyValuePair kv) => L(kv.Key).Contains("sound") && !Other(L(kv.Key))).Value; } if (Plugin.Diagnostics.Value) { Plugin.Log.LogInfo((object)("[Diagnostics] audio channels: " + string.Join(", ", list.Select((KeyValuePair kv) => kv.Key + " (" + ((Object)kv.Value).name + ")")) + " -> SkinTrade uses " + (((Object)(object)val2 != (Object)null) ? ((Object)val2).name : "master"))); } _sfxGroup = val2; if ((Object)(object)val2 == (Object)null) { _nextMixerLookup = float.MaxValue; } return val2; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Audio channel lookup failed: " + ex.Message)); _nextMixerLookup = float.MaxValue; return null; } } private static string L(string n) { return (n ?? "").ToLowerInvariant(); } private static bool Other(string n) { if (!n.Contains("micro") && !n.Contains("tts") && !n.Contains("music") && !n.Contains("spectate")) { return n.Contains("voice"); } return true; } private static object InputMgr() { Type type = FindType("InputManager"); if (type == null) { return null; } if (_inputKeyType == null) { _inputKeyType = FindType("InputKey"); _rumbleType = type.GetNestedType("RumbleThockType", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { ParameterInfo[] parameters = methodInfo.GetParameters(); if (methodInfo.Name == "KeyDown" && parameters.Length >= 1 && parameters[0].ParameterType == _inputKeyType && methodInfo.ReturnType == typeof(bool)) { _keyDown = methodInfo; } else if (methodInfo.Name == "KeyHold" && parameters.Length >= 1 && parameters[0].ParameterType == _inputKeyType && methodInfo.ReturnType == typeof(bool)) { _keyHold = methodInfo; } else if (methodInfo.Name == "GetKeyString" && parameters.Length >= 1 && parameters[0].ParameterType == _inputKeyType && methodInfo.ReturnType == typeof(string)) { _keyString = methodInfo; } else if (methodInfo.Name == "GamepadRumbleThock" && parameters.Length >= 1 && parameters[0].ParameterType == _rumbleType) { _rumble = methodInfo; } else if (methodInfo.Name == "get_CurrentDeviceType" && parameters.Length == 0) { _deviceType = methodInfo; } } } return StaticInstance(type); } private static object[] Args(MethodInfo m, object first) { ParameterInfo[] parameters = m.GetParameters(); object[] array = new object[parameters.Length]; array[0] = first; for (int i = 1; i < parameters.Length; i++) { array[i] = (parameters[i].HasDefaultValue ? parameters[i].DefaultValue : (parameters[i].ParameterType.IsValueType ? Activator.CreateInstance(parameters[i].ParameterType) : null)); } return array; } internal static List MonsterNames() { if (_monsterNames != null && _monsterNames.Count > 0) { return _monsterNames; } if (Time.unscaledTime - _monsterScanAt < 10f) { return null; } _monsterScanAt = Time.unscaledTime; try { Type type = FindType("EnemyDirector"); Type type2 = FindType("EnemyParent"); object obj = StaticInstance(type); if (obj == null || type2 == null) { return null; } List list = new List(); string[] array = new string[3] { "enemiesDifficulty1", "enemiesDifficulty2", "enemiesDifficulty3" }; foreach (string name in array) { if (!(type.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(obj) is IEnumerable enumerable)) { continue; } foreach (object item in enumerable) { if (!(Get(item, "spawnObjects") is IEnumerable enumerable2)) { continue; } foreach (object item2 in enumerable2) { if (item2 == null) { continue; } GameObject val = (GameObject)(((item2 is GameObject) ? item2 : null) ?? ((object)/*isinst with value type is only supported in some contexts*/)); if (!((Object)(object)val == (Object)null) && Get(val.GetComponentInChildren(type2, true), "enemyName") is string text && !string.IsNullOrWhiteSpace(text)) { string text2 = text.Trim().ToUpperInvariant(); if (text2.StartsWith("THE ")) { text2 = text2.Substring(4).Trim(); } if (text2.Length > 0 && text2.Length <= 20 && !list.Contains(text2)) { list.Add(text2); } } } } } if (list.Count >= 3) { _monsterNames = list; Plugin.Log.LogInfo((object)("Monster names from the game: " + string.Join(", ", list))); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Reading monster names failed: " + ex.GetBaseException().Message)); } return _monsterNames; } internal static bool MenuOpen() { try { Type type = FindType("MenuManager"); object obj = StaticInstance(type); if (obj == null) { return false; } if (_currentPage == null) { _currentPage = type.GetField("currentMenuPage", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); } object? obj2 = _currentPage?.GetValue(obj); Object val = (Object)((obj2 is Object) ? obj2 : null); return val != null && val != (Object)null; } catch { return false; } } internal static bool GameKeyDown(string inputKey) { try { object obj = InputMgr(); if (obj == null || _keyDown == null) { return false; } return (bool)_keyDown.Invoke(obj, Args(_keyDown, Enum.Parse(_inputKeyType, inputKey))); } catch { return false; } } internal static void MenuEffect(string effect, string enumArg = null) { try { Type type = FindType("MenuManager"); object obj = StaticInstance(type); if (type == null || obj == null) { return; } MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name != effect) { continue; } ParameterInfo[] parameters = methodInfo.GetParameters(); object[] array = new object[parameters.Length]; for (int j = 0; j < parameters.Length; j++) { Type parameterType = parameters[j].ParameterType; if (j == 0 && enumArg != null && parameterType.IsEnum) { array[j] = Enum.Parse(parameterType, enumArg); } else if (parameters[j].HasDefaultValue) { array[j] = parameters[j].DefaultValue; } else if (parameterType == typeof(float)) { array[j] = -1f; } else { array[j] = (parameterType.IsValueType ? Activator.CreateInstance(parameterType) : null); } } methodInfo.Invoke(obj, array); break; } } catch { } } internal static Texture MenuSelectionTexture(out Color color) { //IL_0015: 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_00b4: 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_00bb: 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_00cc: Unknown result type (might be due to invalid IL or missing references) color = new Color(0.16f, 0.36f, 0.86f, 1f); try { Type type = FindType("MenuSelectionBox"); if (type == null) { return null; } Object[] array = Resources.FindObjectsOfTypeAll(type); foreach (Object obj in array) { Component val = (Component)(object)((obj is Component) ? obj : null); if (val == null || (Object)(object)val == (Object)null) { continue; } object obj2 = Get(val, "rawImage"); RawImage val2 = (RawImage)(((obj2 is RawImage) ? obj2 : null) ?? val.GetComponentInChildren(true)); if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.texture == (Object)null)) { if (Get(val, "colorIdleDefault") is Color val3 && val3.a > 0.05f) { color = val3; } return val2.texture; } } } catch { } return null; } internal static void MenuSound(string effect) { try { Type type = FindType("MenuManager"); object obj = StaticInstance(type); type?.GetMethod(effect, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null)?.Invoke(obj, null); } catch { } } internal static bool GameKeyHeld(string inputKey) { try { object obj = InputMgr(); if (obj == null || _keyHold == null) { return false; } return (bool)_keyHold.Invoke(obj, Args(_keyHold, Enum.Parse(_inputKeyType, inputKey))); } catch { return false; } } internal static string GameKeyName(string inputKey) { try { object obj = InputMgr(); if (obj == null || _keyString == null) { return null; } string text = _keyString.Invoke(obj, Args(_keyString, Enum.Parse(_inputKeyType, inputKey))) as string; return (string.IsNullOrWhiteSpace(text) || text.Contains("<") || text.Length > 20) ? null : text.Trim().ToUpperInvariant(); } catch { return null; } } internal static bool GameUsesGamepad() { try { object obj = InputMgr(); object obj2 = ((obj != null && _deviceType != null) ? _deviceType.Invoke(obj, null) : null); return obj2 != null && obj2.ToString() != "KeyboardMouse"; } catch { return false; } } internal static void Rumble(string type) { try { object obj = InputMgr(); if (obj != null && !(_rumble == null)) { _rumble.Invoke(obj, Args(_rumble, Enum.Parse(_rumbleType, type))); } } catch { } } } internal static class IconFactory { public sealed class Icon { public Sprite Sprite; public Texture Texture; } private sealed class Model { public List Parts; public Bounds Bounds; } private struct Part { public Mesh Mesh; public Matrix4x4 Matrix; public Material[] Materials; } private const BindingFlags Inst = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private const int Layer = 31; private const int Size = 160; private static readonly Dictionary _cache = new Dictionary(); private static readonly Queue _queue = new Queue(); private static readonly HashSet _queued = new HashSet(); private static int _bySprite; private static int _byRender; private static int _byTexture; private static int _none; private static bool _renderBroken; private static GameObject _rig; private static Camera _cam; private static RenderTexture _rt; private static RenderTexture _liveRt; private static readonly Dictionary _models = new Dictionary(); private static readonly Dictionary _loading = new Dictionary(); private static MethodInfo _loadAsset; private static bool _addrResolved; private static int _byAddressable; private static int _byBaked; private static MethodInfo _hashCompute; private static MethodInfo _loadImage; private static bool _bakedResolved; public static bool TryGet(int id, out Icon icon) { if (_cache.TryGetValue(id, out icon)) { return true; } if (_queued.Add(id)) { _queue.Enqueue(id); } return false; } public static void Process(int budget) { PollLoads(); while (budget-- > 0 && _queue.Count > 0) { int num = _queue.Dequeue(); _queued.Remove(num); Icon icon = null; bool pending = false; try { icon = Make(num, out pending); } catch (Exception ex) { Plugin.Log.LogWarning((object)$"Icon for cosmetic {num} failed: {ex.GetBaseException().Message}"); } if (!pending) { Finish(num, icon); } } } private static void Finish(int id, Icon icon) { _cache[id] = icon; if (icon == null) { _none++; } if (_queue.Count == 0 && _loading.Count == 0 && Plugin.Diagnostics.Value) { Plugin.Log.LogInfo((object)$"Icons so far: {_bySprite} sprite, {_byBaked} baked, {_byAddressable} loaded, {_byRender} rendered, {_byTexture} texture, {_none} placeholder."); } } private static void PollLoads() { if (_loading.Count == 0) { return; } foreach (int item in _loading.Keys.ToList()) { object obj = _loading[item]; Sprite val = null; try { Type type = obj.GetType(); if (!(bool)type.GetProperty("IsDone").GetValue(obj)) { continue; } if (type.GetProperty("Status").GetValue(obj)?.ToString() == "Succeeded") { object? value = type.GetProperty("Result").GetValue(obj); val = (Sprite)((value is Sprite) ? value : null); } goto IL_00ac; } catch { val = null; goto IL_00ac; } IL_00ac: _loading.Remove(item); if ((Object)(object)val != (Object)null) { _byAddressable++; Finish(item, new Icon { Sprite = val }); continue; } Icon icon = null; try { icon = Fallback(item); } catch { } Finish(item, icon); } } private static Sprite LoadBaked(object asset) { //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) try { Object val = (Object)((asset is Object) ? asset : null); if (val == null || val == (Object)null) { return null; } if (!_bakedResolved) { _bakedResolved = true; _hashCompute = typeof(Hash128).GetMethod("Compute", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(string) }, null); _loadImage = GameBridge.FindType("UnityEngine.ImageConversion")?.GetMethod("LoadImage", BindingFlags.Static | BindingFlags.Public, null, new Type[2] { typeof(Texture2D), typeof(byte[]) }, null); } if (_hashCompute == null || _loadImage == null) { return null; } string text = _hashCompute.Invoke(null, new object[1] { val.name })?.ToString(); if (string.IsNullOrEmpty(text)) { return null; } string path = Path.Combine(Application.streamingAssetsPath, "BakedIcons", "Cosmetics", text + ".png"); if (!File.Exists(path)) { return null; } Texture2D val2 = new Texture2D(2, 2, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; if (!(bool)_loadImage.Invoke(null, new object[2] { val2, File.ReadAllBytes(path) })) { Object.Destroy((Object)(object)val2); return null; } ((Object)val2).hideFlags = (HideFlags)61; return Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f), 100f); } catch { return null; } } private static object StartLoad(object asset) { object obj = asset.GetType().GetField("iconRef", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(asset); if (obj == null) { return null; } MethodInfo method = obj.GetType().GetMethod("RuntimeKeyIsValid", Type.EmptyTypes); if (method != null && !(bool)method.Invoke(obj, null)) { return null; } if (!_addrResolved) { _addrResolved = true; _loadAsset = (GameBridge.FindType("UnityEngine.AddressableAssets.Addressables")?.GetMethods(BindingFlags.Static | BindingFlags.Public).FirstOrDefault((MethodInfo m) => m.Name == "LoadAssetAsync" && m.IsGenericMethodDefinition && m.GetParameters().Length == 1 && m.GetParameters()[0].ParameterType == typeof(object)))?.MakeGenericMethod(typeof(Sprite)); if (_loadAsset == null) { Plugin.Log.LogWarning((object)"Addressables.LoadAssetAsync not found - skins are shown with letters."); } } if (_loadAsset == null) { return null; } return _loadAsset.Invoke(null, new object[1] { obj }); } private static IEnumerable Fields(Type t) { while (t != null && t != typeof(ScriptableObject) && t != typeof(Object) && t != typeof(object)) { FieldInfo[] fields = t.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); for (int i = 0; i < fields.Length; i++) { yield return fields[i]; } t = t.BaseType; } } private static IEnumerable Values(object asset) { foreach (FieldInfo item in Fields(asset.GetType())) { object value; try { value = item.GetValue(asset); } catch { continue; } if (value is IList list && !(value is string)) { foreach (object item2 in list) { if (item2 != null) { yield return item2; } } } else if (value != null) { yield return value; } } } private static bool Alive(object o) { Object val = (Object)((o is Object) ? o : null); if (val != null) { return val != (Object)null; } return false; } private static Icon Make(int id, out bool pending) { pending = false; object obj = GameBridge.AssetObject(id); if (obj == null) { return null; } Sprite val = Values(obj).Where(Alive).OfType().FirstOrDefault(); if ((Object)(object)val != (Object)null) { _bySprite++; return new Icon { Sprite = val }; } Sprite val2 = LoadBaked(obj); if ((Object)(object)val2 != (Object)null) { _byBaked++; return new Icon { Sprite = val2 }; } if (!_loading.ContainsKey(id)) { object obj2 = null; try { obj2 = StartLoad(obj); } catch (Exception ex) { Plugin.Log.LogWarning((object)$"Icon load for cosmetic {id} failed: {ex.GetBaseException().Message}"); } if (obj2 != null) { _loading[id] = obj2; pending = true; return null; } } return Fallback(id); } private static Icon Fallback(int id) { object obj = GameBridge.AssetObject(id); if (obj == null) { return null; } List list = Values(obj).Where(Alive).ToList(); if (!_renderBroken) { foreach (object item in list) { object obj2 = ((item is GameObject) ? item : null); if (obj2 == null) { object obj3 = ((item is Component) ? item : null); obj2 = ((obj3 != null) ? ((Component)obj3).gameObject : null); } GameObject val = (GameObject)obj2; if ((Object)(object)val == (Object)null) { continue; } Model model = BuildModel(val); if (model != null) { Texture2D val2 = RenderIcon(model); if ((Object)(object)val2 != (Object)null) { _models[id] = model; _byRender++; return new Icon { Texture = (Texture)(object)val2 }; } } } } Texture val3 = list.OfType().FirstOrDefault(); if ((Object)(object)val3 != (Object)null) { _byTexture++; return new Icon { Texture = val3 }; } return null; } private static void EnsureRig() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_00af: 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_011a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_cam != (Object)null)) { _rig = new GameObject("SkinTradeIconRig"); Object.DontDestroyOnLoad((Object)(object)_rig); ((Object)_rig).hideFlags = (HideFlags)61; _rig.transform.position = new Vector3(0f, -5000f, 0f); GameObject val = new GameObject("Camera"); val.transform.SetParent(_rig.transform, false); _cam = val.AddComponent(); ((Behaviour)_cam).enabled = false; _cam.clearFlags = (CameraClearFlags)2; _cam.backgroundColor = new Color(0f, 0f, 0f, 0f); _cam.cullingMask = int.MinValue; _cam.fieldOfView = 22f; _cam.allowHDR = false; _cam.allowMSAA = false; AddLight(new Vector3(40f, -35f, 0f), 1.15f); AddLight(new Vector3(-20f, 150f, 0f), 0.45f); } } private static void AddLight(Vector3 euler, float intensity) { //IL_0005: 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_0020: 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_0027: 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) GameObject val = new GameObject("Light"); val.transform.SetParent(_rig.transform, false); val.transform.rotation = Quaternion.Euler(euler); Light obj = val.AddComponent(); obj.type = (LightType)1; obj.intensity = intensity; obj.color = new Color(1f, 0.96f, 0.9f); obj.cullingMask = int.MinValue; obj.shadows = (LightShadows)0; } private static Model BuildModel(GameObject prefab) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) List list = new List(); Matrix4x4 worldToLocalMatrix = prefab.transform.worldToLocalMatrix; Renderer[] componentsInChildren = prefab.GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if (val.enabled && !((object)val).GetType().Name.Contains("Particle")) { SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)(object)((val is SkinnedMeshRenderer) ? val : null); object obj; if (val2 == null) { MeshFilter component = ((Component)val).GetComponent(); obj = ((component != null) ? component.sharedMesh : null); } else { obj = val2.sharedMesh; } Mesh val3 = (Mesh)obj; if (!((Object)(object)val3 == (Object)null)) { list.Add(new Part { Mesh = val3, Matrix = worldToLocalMatrix * ((Component)val).transform.localToWorldMatrix, Materials = val.sharedMaterials }); } } } if (list.Count == 0) { return null; } bool flag = false; Bounds bounds = default(Bounds); foreach (Part item in list) { Part current = item; Bounds bounds2 = current.Mesh.bounds; for (int j = 0; j < 8; j++) { Vector3 val4 = ((Bounds)(ref bounds2)).center + Vector3.Scale(((Bounds)(ref bounds2)).extents, new Vector3((float)(((j & 1) != 0) ? 1 : (-1)), (float)(((j & 2) != 0) ? 1 : (-1)), (float)(((j & 4) != 0) ? 1 : (-1)))); Vector3 val5 = ((Matrix4x4)(ref current.Matrix)).MultiplyPoint3x4(val4); if (!flag) { bounds = new Bounds(val5, Vector3.zero); flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val5); } } } return new Model { Parts = list, Bounds = bounds }; } private static bool Draw(Model m, float yaw, RenderTexture target) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0098: 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_00aa: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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) EnsureRig(); Vector3 extents = ((Bounds)(ref m.Bounds)).extents; float num = Mathf.Max(((Vector3)(ref extents)).magnitude, 0.001f); Vector3 position = _rig.transform.position; Matrix4x4 val = Matrix4x4.TRS(position, Quaternion.Euler(10f, yaw, 0f), Vector3.one) * Matrix4x4.Translate(-((Bounds)(ref m.Bounds)).center); float num2 = num / Mathf.Sin(_cam.fieldOfView * 0.5f * (MathF.PI / 180f)) * 1.02f; ((Component)_cam).transform.position = position + new Vector3(0f, 0f, 0f - num2); ((Component)_cam).transform.rotation = Quaternion.identity; _cam.nearClipPlane = Mathf.Max(0.001f, num2 - num * 2f); _cam.farClipPlane = num2 + num * 2f; _cam.targetTexture = target; foreach (Part part in m.Parts) { for (int i = 0; i < part.Mesh.subMeshCount; i++) { Material[] materials = part.Materials; Material val2 = ((materials == null || materials.Length == 0) ? null : materials[Mathf.Min(i, materials.Length - 1)]); if ((Object)(object)val2 != (Object)null) { Graphics.DrawMesh(part.Mesh, val * part.Matrix, val2, 31, _cam, i); } } } try { _cam.Render(); return true; } catch (Exception ex) { _renderBroken = true; Plugin.Log.LogWarning((object)("Rendering cosmetic previews is not possible here - using placeholders. " + ex.GetBaseException().Message)); return false; } } private static Texture2D RenderIcon(Model m) { //IL_0042: 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_004f: Expected O, but got Unknown //IL_0064: 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 (!Draw(m, 155f, _rt ?? CreateRt(ref _rt))) { return null; } RenderTexture active = RenderTexture.active; RenderTexture.active = _rt; Texture2D val = new Texture2D(160, 160, (TextureFormat)4, false) { filterMode = (FilterMode)1 }; val.ReadPixels(new Rect(0f, 0f, 160f, 160f), 0, 0); val.Apply(); RenderTexture.active = active; int num = 0; Color32[] pixels = val.GetPixels32(); for (int i = 0; i < pixels.Length; i++) { if (pixels[i].a > 10) { num++; } } if (num < 30) { Object.Destroy((Object)(object)val); return null; } return val; } private static RenderTexture CreateRt(ref RenderTexture rt, int size = 160) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown rt = new RenderTexture(size, size, 24, (RenderTextureFormat)0) { antiAliasing = 1 }; rt.Create(); return rt; } public static Texture RenderLive(int id, float yaw) { if (_renderBroken || !_models.TryGetValue(id, out var value)) { return null; } if ((Object)(object)_liveRt == (Object)null) { CreateRt(ref _liveRt, 256); } if (!Draw(value, yaw, _liveRt)) { return null; } return (Texture)(object)_liveRt; } } internal sealed class KeyInput : MonoBehaviour { private static int _guiPressedFrame = -10; private static PropertyInfo _current; private static PropertyInfo _keyProp; private static PropertyInfo _wasPressed; private static string _resolvedFor; private static KeyCode _guiKey; public unsafe static bool PressedThisFrame(KeyCode key) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (_guiPressedFrame >= Time.frameCount - 1 && _guiKey == key) { _guiPressedFrame = -10; return true; } try { string text = ((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString().ToLowerInvariant() + "Key"; if (_resolvedFor != text) { _resolvedFor = text; Type type = GameBridge.FindType("UnityEngine.InputSystem.Keyboard"); _current = type?.GetProperty("current", BindingFlags.Static | BindingFlags.Public); _keyProp = type?.GetProperty(text, BindingFlags.Instance | BindingFlags.Public); _wasPressed = _keyProp?.PropertyType.GetProperty("wasPressedThisFrame", BindingFlags.Instance | BindingFlags.Public); } object obj = _current?.GetValue(null); object obj2 = ((obj == null) ? null : _keyProp?.GetValue(obj)); return obj2 != null && _wasPressed != null && (bool)_wasPressed.GetValue(obj2); } catch { return false; } } public static bool AcceptPressed() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) if (!PressedThisFrame(Plugin.AcceptKey.Value)) { if (GameBridge.GameUsesGamepad()) { return GameBridge.GameKeyDown("Interact"); } return false; } return true; } public static string AcceptLabel() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!GameBridge.GameUsesGamepad()) { return ((object)Plugin.AcceptKey.Value/*cast due to .constrained prefix*/).ToString().ToUpperInvariant(); } return GameBridge.GameKeyName("Interact") ?? "INTERACT"; } private void OnGUI() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_0010: 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) Event current = Event.current; if ((int)current.type == 4 && (int)current.keyCode != 0) { _guiKey = current.keyCode; _guiPressedFrame = Time.frameCount; } } } internal static class Pad { public static Vector2 LeftStick; public static Vector2 RightStick; public static bool ADown; public static bool AUp; public static bool AHeld; public static bool BDown; public static bool XDown; public static bool YDown; public static bool LBDown; public static bool RBDown; public static bool UpDown; public static bool DownDown; public static bool LeftDown; public static bool RightDown; private const float DeadZone = 0.18f; private static int _frame = -1; private static PropertyInfo _current; private static bool _resolved; private static readonly Dictionary _props = new Dictionary(); private static readonly Dictionary _readValue = new Dictionary(); private static PropertyInfo _isPressed; private static PropertyInfo _wasPressed; private static PropertyInfo _wasReleased; public static bool Connected { get; private set; } public static bool Active { get; private set; } public static void Poll() { //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_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_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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) if (_frame == Time.frameCount) { return; } _frame = Time.frameCount; ADown = (AUp = (AHeld = (BDown = (XDown = (YDown = (LBDown = (RBDown = (UpDown = (DownDown = (LeftDown = (RightDown = false))))))))))); LeftStick = (RightStick = Vector2.zero); Active = false; try { if (!_resolved) { _resolved = true; _current = GameBridge.FindType("UnityEngine.InputSystem.Gamepad")?.GetProperty("current", BindingFlags.Static | BindingFlags.Public); } object obj = _current?.GetValue(null); Connected = obj != null; if (obj != null) { LeftStick = Stick(obj, "leftStick"); RightStick = Stick(obj, "rightStick"); Button(obj, "buttonSouth", out ADown, out AUp, out AHeld); Button(obj, "buttonEast", out BDown, out var up, out var held); Button(obj, "buttonWest", out XDown, out held, out up); Button(obj, "buttonNorth", out YDown, out up, out held); Button(obj, "leftShoulder", out LBDown, out held, out up); Button(obj, "rightShoulder", out RBDown, out up, out held); object obj2 = Get(obj, "dpad"); if (obj2 != null) { Button(obj2, "up", out UpDown, out held, out up); Button(obj2, "down", out DownDown, out up, out held); Button(obj2, "left", out LeftDown, out held, out up); Button(obj2, "right", out RightDown, out up, out held); } Active = ((Vector2)(ref LeftStick)).sqrMagnitude > 0f || ((Vector2)(ref RightStick)).sqrMagnitude > 0f || ADown || AHeld || BDown || XDown || YDown || LBDown || RBDown || UpDown || DownDown || LeftDown || RightDown; } } catch { Connected = false; } } private static object Get(object owner, string name) { string key = owner.GetType().FullName + "." + name; if (!_props.TryGetValue(key, out var value)) { value = (_props[key] = owner.GetType().GetProperty(name, BindingFlags.Instance | BindingFlags.Public)); } return value?.GetValue(owner); } private static Vector2 Stick(object pad, string name) { //IL_000b: 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_004d: 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_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_0095: 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) object obj = Get(pad, name); if (obj == null) { return Vector2.zero; } Type type = obj.GetType(); if (!_readValue.TryGetValue(type, out var value)) { value = (_readValue[type] = type.GetMethod("ReadValue", Type.EmptyTypes)); } Vector2 val = (Vector2)((value != null) ? ((Vector2)value.Invoke(obj, null)) : Vector2.zero); float magnitude = ((Vector2)(ref val)).magnitude; if (magnitude < 0.18f) { return Vector2.zero; } return val / magnitude * Mathf.Clamp01((magnitude - 0.18f) / 0.82f); } private static void Button(object owner, string name, out bool down, out bool up, out bool held) { down = (up = (held = false)); object obj = Get(owner, name); if (obj != null) { if (_isPressed == null) { Type type = obj.GetType(); _isPressed = type.GetProperty("isPressed"); _wasPressed = type.GetProperty("wasPressedThisFrame"); _wasReleased = type.GetProperty("wasReleasedThisFrame"); } held = _isPressed != null && (bool)_isPressed.GetValue(obj); down = _wasPressed != null && (bool)_wasPressed.GetValue(obj); up = _wasReleased != null && (bool)_wasReleased.GetValue(obj); } } } [BepInPlugin("skintrade.repo", "SkinTrade", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string Guid = "skintrade.repo"; public const string ModName = "SkinTrade"; public const string Version = "1.0.0"; public const string Build = "2026-11-29 16:25"; internal static ManualLogSource Log; internal static ConfigEntry HandshakeSeconds; internal static ConfigEntry MaxDistance; internal static ConfigEntry AcceptKey; internal static ConfigEntry SoundVolume; internal static ConfigEntry SoundMixerGroup; internal static ConfigEntry HousingResolution; internal static ConfigEntry ScreenCurvature; internal static ConfigEntry SoundClipName; internal static ConfigEntry LogAudioClips; internal static ConfigEntry ExcludedCosmeticIds; internal static ConfigEntry TitleFontName; internal static ConfigEntry Diagnostics; internal static ConfigEntry BackupEnabled; internal static ConfigEntry BackupKeep; internal static ConfigEntry ShowTradingSigns; internal static ConfigEntry SignHeight; private void Awake() { //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Expected O, but got Unknown //IL_0241: 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: Expected O, but got Unknown //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; HandshakeSeconds = ((BaseUnityPlugin)this).Config.Bind("Handshake", "ShakeSeconds", 0.3f, "How long both players have to hold out their right hand (look at each other and hold the grab button) to start a deal."); MaxDistance = ((BaseUnityPlugin)this).Config.Bind("Handshake", "ShakeDistance", 2f, "How close (metres, centre to centre) both players have to stand face to face for a handshake."); AcceptKey = ((BaseUnityPlugin)this).Config.Bind("Handshake", "AcceptKey", (KeyCode)101, "Key the other player presses to accept the deal while \"WANNA TRADE?\" is shown."); TitleFontName = ((BaseUnityPlugin)this).Config.Bind("Visuals", "TitleFontName", "", "Font for the \"SkinTrade\" title (part of a TMP font name from the game). Empty = automatic. Diagnostics lists all font names."); SoundVolume = ((BaseUnityPlugin)this).Config.Bind("Sound", "Volume", 0.6f, "Volume of the SkinTrade sounds relative to the game's sound effects (0-1). The game's volume sliders apply on top."); SoundMixerGroup = ((BaseUnityPlugin)this).Config.Bind("Sound", "MixerGroup", "auto", "Game audio channel the sounds play on, so the game's sound effects volume controls them. auto = the game's sound effects channel. Diagnostics lists all channel names."); SoundClipName = ((BaseUnityPlugin)this).Config.Bind("Sound", "SoundClipName", "", "Name of a game sound to use for typing/clicks. Empty = built-in robot blip. Use LogAudioClips to find names."); LogAudioClips = ((BaseUnityPlugin)this).Config.Bind("Sound", "LogAudioClips", false, "Write the names of all loaded game sounds to the BepInEx log once you are in the shop."); ExcludedCosmeticIds = ((BaseUnityPlugin)this).Config.Bind("Advanced", "ExcludedCosmeticIds", "0", "Comma-separated cosmetic ids that can never be traded (0 = the default/empty slot)."); BackupEnabled = ((BaseUnityPlugin)this).Config.Bind("Safety", "BackupBeforeDeal", true, "Copy the game's meta save (cosmetics + coins) to BepInEx/SkinTrade/backups right before every deal."); BackupKeep = ((BaseUnityPlugin)this).Config.Bind("Safety", "BackupsToKeep", 10, "How many backups to keep."); HousingResolution = ((BaseUnityPlugin)this).Config.Bind("Visuals", "HousingResolution", 0, "Optional retro look of the terminal housing (0 = off, sharp): it is rendered as if the screen had this many lines - the same for everyone, independent of the game's graphics settings and your screen resolution. Lower = more pixelated, 0 = sharp. Screen content, all lettering and the receipt stay sharp."); ScreenCurvature = ((BaseUnityPlugin)this).Config.Bind("Visuals", "ScreenCurvature", 0.06f, "Bulge of the terminal screen like an old tube monitor (0 = flat, 0.06 = like the game's menus, max 0.3)."); ShowTradingSigns = ((BaseUnityPlugin)this).Config.Bind("Visuals", "ShowTradingSigns", true, "Show a \"TRADING\" sign above players who are trading."); SignHeight = ((BaseUnityPlugin)this).Config.Bind("Visuals", "TradingSignHeight", 2.1f, "Height of the TRADING sign above the player (metres)."); Diagnostics = ((BaseUnityPlugin)this).Config.Bind("Advanced", "Diagnostics", true, "Writes fonts, cosmetic data layout and icon statistics to the log once (helps with bug reports)."); GameObject val = new GameObject("SkinTrade"); Object.DontDestroyOnLoad((Object)val); ((Object)val).hideFlags = (HideFlags)61; Sfx.Init(val); val.AddComponent(); val.AddComponent(); val.AddComponent(); val.AddComponent(); val.AddComponent(); Log.LogInfo((object)"SkinTrade 1.0.0 (build 2026-11-29 16:25) loaded. Look at each other and hold the grab button to shake hands."); } } internal static class Sfx { private const int Rate = 44100; private static AudioSource _src; private static AudioClip _gameClip; private static bool _searched; private static bool _logged; private static readonly Dictionary _clips = new Dictionary(); private static readonly Random _rng = new Random(42); private static float _lastTick = -9f; private static AudioClip[] _truckTyping; private static float _truckTypingVolume = 1f; private static float _truckSearchAt = -99f; public const float PrinterLead = 0.3f; public const float PrinterPrint = 0.15f; public const float PrinterFeed = 0.06f; public const float PrinterLine = 0.21000001f; public const float PrinterTail = 0.25f; public static void Init(GameObject host) { _src = host.AddComponent(); _src.playOnAwake = false; _src.spatialBlend = 0f; _src.ignoreListenerPause = true; } public static void Type(float pitch = 1f) { Play(TypeClip(), pitch, TypeVolume()); } public static void TypeTick() { if (!(Time.unscaledTime - _lastTick < 0.028f)) { _lastTick = Time.unscaledTime; Play(TypeClip(), Random.Range(0.94f, 1.08f), TypeVolume() * 0.8f); } } private static float TypeVolume() { if (_truckTyping == null) { return 1f; } return Mathf.Clamp(_truckTypingVolume * 2f, 0.3f, 1f); } public static void Hover() { Play(Get("tick", () => Tone(0.025f, 2400f, 0.25f, 120f)), 1f, 0.35f); } public static void Click() { Play(Get("click", () => Mix(Noise(0.006f, 0.6f, 900f), Tone(0.03f, 1500f, 0.3f, 90f))), 1f, 0.7f); } public static void Deny() { Play(Get("deny", () => Tone(0.16f, 160f, 0.45f, 12f, square: true)), 1f, 0.7f); } public static void KeyDown() { Play(Get("keydown", () => Mix(Thump(0.12f, 95f, 0.9f), Noise(0.012f, 0.7f, 400f))), 1f, 0.9f); } public static void KeyUp() { Play(Get("keyup", () => Mix(Thump(0.06f, 160f, 0.4f), Noise(0.008f, 0.5f, 700f))), 1f, 0.6f); } public static void Relay() { Play(Get("relay", () => Mix(Noise(0.005f, 0.9f, 1500f), Tone(0.05f, 2100f, 0.25f, 70f))), 1f, 0.8f); } public static void KnobTick() { Play(Get("knob", () => Mix(Noise(0.004f, 0.8f, 1200f), Tone(0.018f, 3200f, 0.2f, 160f))), 1f, 0.8f); } public static void Stamp() { Play(Get("stamp", () => Mix(Thump(0.22f, 58f, 1f), Noise(0.04f, 0.6f, 60f))), 1f, 1f); } public static void Beep(bool last) { Play(Get(last ? "beep2" : "beep", () => Tone(0.13f, last ? 1320f : 880f, 0.35f, 8f, square: true)), 1f, 0.6f); } public static void ChannelSwitch() { Play(Get("channel", () => Mix(Noise(0.006f, 0.8f, 1200f), Concat(new float[441], Noise(0.42f, 0.32f, 5f)), Tone(0.3f, 120f, 0.18f, 9f, square: true))), 1f, 0.75f); } public static void PaperFlip() { Play(Get("flip", () => Mix(Noise(0.09f, 0.28f, 25f), Noise(0.03f, 0.18f, 90f))), 1f, 0.8f); } public static void Ping() { Play(Get("ping", () => Concat(Tone(0.08f, 660f, 0.4f, 25f), Tone(0.14f, 990f, 0.4f, 18f))), 1f, 0.7f); } public static void CrtOn() { Play(Get("crton", CrtOnClip), 1f, 0.8f); } public static void CrtOff() { Play(Get("crtoff", () => Sweep(0.28f, 900f, 50f, 0.5f)), 1f, 0.7f); } public static void Printer(int lines) { Play(Get("printer" + lines, () => PrinterClip(lines)), 1f, 0.75f); } private static void Play(AudioClip clip, float pitch, float volume) { if (!((Object)(object)_src == (Object)null) && !((Object)(object)clip == (Object)null)) { if ((Object)(object)_src.outputAudioMixerGroup == (Object)null) { _src.outputAudioMixerGroup = GameBridge.SfxMixerGroup(); } _src.pitch = pitch * Random.Range(0.97f, 1.03f); _src.PlayOneShot(clip, Mathf.Clamp01(Plugin.SoundVolume.Value) * volume); } } private static AudioClip Get(string name, Func make) { if (_clips.TryGetValue(name, out var value)) { return value; } float[] array = make(); value = AudioClip.Create("SkinTrade_" + name, array.Length, 1, 44100, false); value.SetData(array, 0); return _clips[name] = value; } private static AudioClip TypeClip() { if (!_searched && !string.IsNullOrWhiteSpace(Plugin.SoundClipName.Value)) { _searched = true; string wanted = Plugin.SoundClipName.Value.Trim(); _gameClip = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)((AudioClip c) => string.Equals(((Object)c).name, wanted, StringComparison.OrdinalIgnoreCase))); Plugin.Log.LogInfo((object)(((Object)(object)_gameClip != (Object)null) ? ("Using game sound '" + ((Object)_gameClip).name + "'.") : ("Sound '" + wanted + "' not found - using built-in blip."))); } if ((Object)(object)_gameClip != (Object)null) { return _gameClip; } if (_truckTyping == null && Time.unscaledTime - _truckSearchAt > 5f) { _truckSearchAt = Time.unscaledTime; try { Type type = GameBridge.FindType("TruckScreenText"); if (type != null) { Object[] array = Resources.FindObjectsOfTypeAll(type); foreach (Object obj in array) { object obj2 = type.GetField("typingSound", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(obj); if (obj2?.GetType().GetField("Sounds")?.GetValue(obj2) is AudioClip[] array2 && array2.Length != 0 && !((Object)(object)array2[0] == (Object)null)) { _truckTyping = array2.Where((AudioClip c) => (Object)(object)c != (Object)null).ToArray(); if (obj2.GetType().GetField("Volume")?.GetValue(obj2) is float truckTypingVolume) { _truckTypingVolume = truckTypingVolume; } Plugin.Log.LogInfo((object)("Typing sound: the game's chat typing (" + ((Object)_truckTyping[0]).name + ").")); break; } } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Typing sound lookup failed: " + ex.Message)); } } if (_truckTyping != null) { return _truckTyping[Random.Range(0, _truckTyping.Length)]; } return Get("blip", BlipClip); } private static float[] Buffer(float seconds) { return new float[Math.Max(1, (int)(44100f * seconds))]; } private static float[] Tone(float seconds, float freq, float amp, float decay, bool square = false) { float[] array = Buffer(seconds); for (int i = 0; i < array.Length; i++) { float num = (float)i / 44100f; float num2 = Mathf.Sin(MathF.PI * 2f * freq * num); if (square) { num2 = Mathf.Sign(num2) * 0.6f; } array[i] = num2 * amp * Mathf.Exp((0f - num) * decay) * Mathf.Min(1f, (float)i / 40f); } return array; } private static float[] Thump(float seconds, float freq, float amp) { float[] array = Buffer(seconds); float num = 0f; for (int i = 0; i < array.Length; i++) { float num2 = (float)i / 44100f; float num3 = freq * (1f + 1.5f * Mathf.Exp((0f - num2) * 60f)); num += MathF.PI * 2f * num3 / 44100f; array[i] = Mathf.Sin(num) * amp * Mathf.Exp((0f - num2) * 28f); } return array; } private static float[] Noise(float seconds, float amp, float decay) { float[] array = Buffer(seconds); float num = 0f; for (int i = 0; i < array.Length; i++) { float num2 = (float)i / 44100f; float num3 = (float)(_rng.NextDouble() * 2.0 - 1.0); num = num * 0.6f + num3 * 0.4f; array[i] = num * amp * Mathf.Exp((0f - num2) * decay); } return array; } private static float[] Sweep(float seconds, float from, float to, float amp) { float[] array = Buffer(seconds); float num = 0f; for (int i = 0; i < array.Length; i++) { float num2 = (float)i / (float)array.Length; float num3 = Mathf.Lerp(from, to, num2 * num2); num += MathF.PI * 2f * num3 / 44100f; float num4 = Mathf.Min(1f, (float)i / 200f) * (1f - num2); array[i] = (Mathf.Sin(num) * 0.7f + (float)(_rng.NextDouble() * 2.0 - 1.0) * 0.15f) * amp * num4; } return array; } private static float[] Mix(params float[][] parts) { float[] array = new float[parts.Max((float[] p) => p.Length)]; foreach (float[] array2 in parts) { for (int num2 = 0; num2 < array2.Length; num2++) { array[num2] += array2[num2]; } } for (int num3 = 0; num3 < array.Length; num3++) { array[num3] = Mathf.Clamp(array[num3], -1f, 1f); } return array; } private static float[] Concat(params float[][] parts) { return parts.SelectMany((float[] p) => p).ToArray(); } private static float[] BlipClip() { float[] array = Buffer(0.055f); for (int i = 0; i < array.Length; i++) { float num = (float)i / 44100f; float num2 = Mathf.Min(1f, (float)i / 120f) * Mathf.Exp((0f - num) * 38f); float num3 = 720f + 260f * Mathf.Exp((0f - num) * 60f); float num4 = Mathf.Sign(Mathf.Sin(MathF.PI * 2f * num3 * num)); float num5 = Mathf.Sin(MathF.PI * 2f * num3 * 0.5f * num) * 0.35f; array[i] = Mathf.Round((num4 * 0.5f + num5) * num2 * 8f) / 8f * 0.45f; } return array; } private static float[] CrtOnClip() { float[] array = Buffer(0.75f); float num = 0f; for (int i = 0; i < array.Length; i++) { float num2 = (float)i / 44100f; float num3 = (float)i / (float)array.Length; float num4 = Mathf.Lerp(55f, 170f, Mathf.Sqrt(num3)); num += MathF.PI * 2f * num4 / 44100f; float num5 = Mathf.Sin(num) * 0.35f * Mathf.Min(1f, num2 * 12f) * (1f - num3 * 0.7f); float num6 = (float)(_rng.NextDouble() * 2.0 - 1.0) * 0.22f * Mathf.Exp((0f - num2) * 6f); float num7 = Mathf.Sin(MathF.PI * 140f * num2) * 0.8f * Mathf.Exp((0f - num2) * 30f); array[i] = Mathf.Clamp(num5 + num6 + num7, -1f, 1f); } return array; } private static float[] Feed(float seconds) { float[] array = Buffer(seconds); float num = 0f; for (int i = 0; i < array.Length; i++) { float num2 = (float)i / 44100f; float num3 = (float)i / (float)array.Length; float num4 = (float)(_rng.NextDouble() * 2.0 - 1.0); num = num * 0.75f + num4 * 0.25f; float num5 = Mathf.Sin(num3 * MathF.PI); array[i] = (num * 0.5f + Mathf.Sin(MathF.PI * 190f * num2) * 0.25f + Mathf.Sign(Mathf.Sin(MathF.PI * 94f * num2)) * 0.06f) * num5 * 0.6f; } return array; } private static float[] PrintLine(float seconds) { float[] array = Buffer(seconds); for (int i = 0; i < array.Length; i++) { float num = (float)i / 44100f; float num2 = (float)i / (float)array.Length; float num3 = 0.5f + 0.5f * Mathf.Sign(Mathf.Sin(MathF.PI * 76f * num)); float num4 = Mathf.Sign(Mathf.Sin(MathF.PI * 820f * num)) * num3; float num5 = (float)(_rng.NextDouble() * 2.0 - 1.0) * 0.3f * num3; float num6 = Mathf.Min(1f, num2 * 12f) * Mathf.Min(1f, (1f - num2) * 12f); array[i] = (num4 * 0.16f + num5 * 0.12f) * num6; } return array; } private static float[] PrinterClip(int lines) { List list = new List { Feed(0.3f) }; for (int i = 0; i < lines; i++) { list.Add(PrintLine(0.15f)); list.Add(Mix(Feed(0.06f), Noise(0.008f, 0.5f, 500f))); } list.Add(Feed(0.25f)); return Concat(list.ToArray()); } public static void LogClipsOnce() { if (!_logged && Plugin.LogAudioClips.Value) { _logged = true; string[] array = (from n in (from c in Resources.FindObjectsOfTypeAll() select ((Object)c).name into n where !string.IsNullOrEmpty(n) select n).Distinct() orderby n select n).ToArray(); Plugin.Log.LogInfo((object)($"--- {array.Length} loaded audio clips (for SoundClipName) ---\n" + string.Join("\n", array))); } } } internal sealed class SkinTradeMenu : MonoBehaviour { [CompilerGenerated] private static class <>O { public static UnityAction <0>__OpenPage; } internal const BindingFlags All = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private const string ButtonName = "SkinTradeMenuButton"; private const string MenuLabel = "SKINTRADE MENU"; internal const int PageIndexValue = 77; internal static Type EscType; internal static Type MenuButtonType; internal static Type MenuPageType; internal static Type MenuManagerType; internal static Type PageIndexType; internal static Type PagesType; private float _nextScan; private GameObject _injected; private Component _injectedFor; private Component _scanFor; private bool _warned; private static GameObject _holder; private static GameObject _template; internal static GameObject ButtonTemplate; private static bool _returnFocus; internal static Color PopupHeaderColor = new Color(1f, 0.33f, 0.2f); internal static Type ScrollType; public static bool IsOpen => (Object)(object)SkinTradePage.Current != (Object)null; internal static object Manager => MenuManagerType?.GetField("instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null); internal static object OwnIndex => Enum.ToObject(PageIndexType, 77); private static bool Resolve() { if (MenuManagerType != null) { if (EscType != null && MenuButtonType != null && MenuPageType != null && PageIndexType != null) { return PagesType != null; } return false; } EscType = GameBridge.FindType("MenuPageEsc"); MenuButtonType = GameBridge.FindType("MenuButton"); MenuPageType = GameBridge.FindType("MenuPage"); MenuManagerType = GameBridge.FindType("MenuManager"); PageIndexType = GameBridge.FindType("MenuPageIndex"); PagesType = MenuManagerType?.GetNestedType("MenuPages", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (EscType != null && MenuButtonType != null && MenuPageType != null && PageIndexType != null) { return PagesType != null; } return false; } private void Update() { try { EnsureButton(); } catch (Exception ex) { if (!_warned) { _warned = true; Plugin.Log.LogWarning((object)("SkinTrade menu button in the pause menu not available: " + ex.GetBaseException().Message)); } } } private void EnsureButton() { //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Expected O, but got Unknown //IL_02ff: 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_0310: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) if (!Resolve()) { return; } object? obj = EscType.GetField("instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null); Component val = (Component)((obj is Component) ? obj : null); if ((Object)(object)val == (Object)null || !val.gameObject.activeInHierarchy || ((Object)(object)_injected != (Object)null && (Object)(object)_injectedFor == (Object)(object)val) || (Time.unscaledTime < _nextScan && (Object)(object)_scanFor == (Object)(object)val)) { return; } _scanFor = val; _nextScan = Time.unscaledTime + 0.25f; Button[] componentsInChildren = val.GetComponentsInChildren