Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of TokenPirata v1.0.1
plugins/TokenPirata.dll
Decompiled 2 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using REPOLib.Modules; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TokenPirata { [HarmonyPatch(typeof(RunManager), "Awake")] internal static class RunManagerAwakePatch { private static void Postfix(RunManager __instance) { if ((Object)(object)RunManager.instance != (Object)(object)__instance) { return; } try { Plugin.BuildAndRegister(); } catch (Exception arg) { Plugin.Log.LogError((object)$"Error creando el token pirata: {arg}"); } } } [HarmonyPatch(typeof(LevelGenerator), "GenerateDoneApply")] internal static class LevelGeneratorDonePatch { private static void Postfix() { try { TrySpawn(); } catch (Exception arg) { Plugin.Log.LogError((object)$"Error haciendo aparecer el token pirata: {arg}"); } } private static void TrySpawn() { //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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) if (Plugin.TokenRef == null || !SemiFunc.IsMasterClientOrSingleplayer() || !SemiFunc.RunIsLevel() || Random.Range(0f, 100f) >= Plugin.SpawnChance.Value) { return; } List<ValuableVolume> list = (from _ in Object.FindObjectsByType<ValuableVolume>((FindObjectsSortMode)0) where (int)_.VolumeType <= 2 orderby Random.value select _).ToList(); if (list.Count == 0) { Plugin.Log.LogWarning((object)"Este nivel no tiene sitios para objetos de valor. No aparece token."); return; } LayerMask mask = SemiFunc.LayerMaskGetPhysGrabObject(); ValuableVolume val = ((IEnumerable<ValuableVolume>)list).FirstOrDefault((Func<ValuableVolume, bool>)((ValuableVolume volume) => volume.OverlapBoxCheck(mask).Length == 0)) ?? list[0]; Vector3 val2 = ((Component)val).transform.position + Vector3.up * 0.05f; if ((Object)(object)NetworkPrefabs.SpawnNetworkPrefab(Plugin.TokenRef, val2, ((Component)val).transform.rotation, (byte)0, (object[])null) != (Object)null) { Plugin.Log.LogInfo((object)$"Token pirata aparecio en {val2}."); } } } [BepInPlugin("abreu.TokenPirata", "TokenPirata", "1.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string Guid = "abreu.TokenPirata"; public const string Name = "TokenPirata"; public const string Version = "1.0.1"; private const string TemplatePath = "Valuables/01 Tiny/Valuable Desert Golden Coin"; private const string PrefabId = "Valuables/Valuable Token Pirata"; internal static ManualLogSource Log; internal static PrefabRef TokenRef; internal static ConfigEntry<float> SpawnChance; internal static ConfigEntry<float> ValueMin; internal static ConfigEntry<float> ValueMax; internal static ConfigEntry<float> Scale; private static GameObject _holder; private void Awake() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; SpawnChance = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ProbabilidadPorNivel", 5f, new ConfigDescription("Probabilidad (%) de que aparezca un token pirata en cada nivel. Solo cuenta la del host. 100 = siempre.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())); ValueMin = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ValorMinimo", 50000f, "Valor minimo del token en dolares. Solo cuenta el del host."); ValueMax = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ValorMaximo", 60000f, "Valor maximo del token en dolares. Solo cuenta el del host."); Scale = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Tamano", 1.6f, new ConfigDescription("Tamano del token respecto a la moneda dorada del juego. Todos los jugadores deben tener el mismo.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 4f), Array.Empty<object>())); new Harmony("abreu.TokenPirata").PatchAll(); Log.LogInfo((object)"TokenPirata 1.0.1 cargado."); } internal static void BuildAndRegister() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) if (TokenRef != null) { return; } GameObject val = FindTemplate(); if ((Object)(object)val == (Object)null) { Log.LogError((object)"No se encontro ningun objeto de valor para usar como plantilla. El token no aparecera."); return; } _holder = new GameObject("TokenPirata Prefabs"); _holder.SetActive(false); ((Object)_holder).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)_holder); GameObject val2 = Object.Instantiate<GameObject>(val, _holder.transform); ((Object)val2).name = "Valuable Token Pirata"; val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; ValuableObject component = val2.GetComponent<ValuableObject>(); if ((Object)(object)component == (Object)null) { Log.LogError((object)("La plantilla \"" + ((Object)val).name + "\" no tiene ValuableObject. El token no aparecera.")); Object.Destroy((Object)(object)_holder); return; } Value val3 = ScriptableObject.CreateInstance<Value>(); ((Object)val3).name = "Value - Token Pirata"; val3.valueMin = Mathf.Min(ValueMin.Value, ValueMax.Value); val3.valueMax = Mathf.Max(ValueMin.Value, ValueMax.Value); component.valuePreset = val3; ReplaceVisuals(val2); val2.transform.localScale = val.transform.localScale * Scale.Value; TokenRef = NetworkPrefabs.RegisterNetworkPrefab("Valuables/Valuable Token Pirata", val2); if (TokenRef == null) { Log.LogError((object)"REPOLib no pudo registrar el token pirata."); } else { Log.LogInfo((object)("Token pirata registrado (plantilla: \"" + ((Object)val).name + "\").")); } } private static GameObject FindTemplate() { GameObject val = Resources.Load<GameObject>("Valuables/01 Tiny/Valuable Desert Golden Coin"); if ((Object)(object)val != (Object)null) { return val; } Log.LogWarning((object)"No se encontro \"Valuables/01 Tiny/Valuable Desert Golden Coin\". Buscando otra plantilla."); foreach (string item in (from prefabRef in (from preset in RunManager.instance.levels.Where((Level level) => (Object)(object)level != (Object)null && level.ValuablePresets != null).SelectMany((Level level) => level.ValuablePresets) where (Object)(object)preset != (Object)null && preset.tiny != null select preset).SelectMany((LevelValuables preset) => preset.tiny) where prefabRef != null && ((PrefabRef<GameObject>)(object)prefabRef).IsValid() && (Object)(object)((PrefabRef<GameObject>)(object)prefabRef).Bundle == (Object)null select ((PrefabRef<GameObject>)(object)prefabRef).ResourcePath).Distinct().OrderBy<string, string>((string path) => path, StringComparer.Ordinal)) { if (!NetworkPrefabs.HasNetworkPrefab(item)) { val = Resources.Load<GameObject>(item); if ((Object)(object)val != (Object)null) { return val; } } } return null; } private static void ReplaceVisuals(GameObject prefab) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0146: 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_005d: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_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_0185: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e2: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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) Transform transform = prefab.transform; Material val = null; bool flag = false; Bounds val2 = default(Bounds); ((Bounds)(ref val2))..ctor(Vector3.zero, Vector3.zero); MeshRenderer[] componentsInChildren = prefab.GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val3 in componentsInChildren) { MeshFilter component = ((Component)val3).GetComponent<MeshFilter>(); if ((Object)(object)component != (Object)null && (Object)(object)component.sharedMesh != (Object)null) { Matrix4x4 val4 = transform.worldToLocalMatrix * ((Component)component).transform.localToWorldMatrix; Bounds bounds = component.sharedMesh.bounds; for (int j = 0; j < 8; j++) { Vector3 val5 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3(((j & 1) == 0) ? (-1f) : 1f, ((j & 2) == 0) ? (-1f) : 1f, ((j & 4) == 0) ? (-1f) : 1f)); Vector3 val6 = ((Matrix4x4)(ref val4)).MultiplyPoint3x4(val5); if (!flag) { ((Bounds)(ref val2))..ctor(val6, Vector3.zero); flag = true; } else { ((Bounds)(ref val2)).Encapsulate(val6); } } } if ((Object)(object)val == (Object)null) { val = ((Renderer)val3).sharedMaterial; } ((Renderer)val3).enabled = false; } if (!flag) { ((Bounds)(ref val2))..ctor(Vector3.zero, new Vector3(0.15f, 0.02f, 0.15f)); } Vector3 size = ((Bounds)(ref val2)).size; int num = 0; if (size.y < ((Vector3)(ref size))[num]) { num = 1; } if (size.z < ((Vector3)(ref size))[num]) { num = 2; } float num2 = (size.x + size.y + size.z - ((Vector3)(ref size))[num]) / 2f; float num3 = Mathf.Max(((Vector3)(ref size))[num], num2 * 0.1f); Vector3 zero = Vector3.zero; ((Vector3)(ref zero))[num] = 1f; GameObject val7 = new GameObject("Token Pirata Visual") { layer = prefab.layer }; val7.transform.SetParent(transform, false); val7.transform.localPosition = ((Bounds)(ref val2)).center; val7.transform.localRotation = Quaternion.FromToRotation(Vector3.up, zero); val7.transform.localScale = new Vector3(num2, num3, num2); val7.AddComponent<MeshFilter>().sharedMesh = TokenArt.BuildCoinMesh(); ((Renderer)val7.AddComponent<MeshRenderer>()).sharedMaterial = TokenArt.BuildMaterial(val); GameObject val8 = new GameObject("Token Pirata Glow"); val8.transform.SetParent(transform, false); val8.transform.localPosition = ((Bounds)(ref val2)).center; Light obj = val8.AddComponent<Light>(); obj.type = (LightType)2; obj.color = new Color(1f, 0.78f, 0.25f); obj.range = 2.5f; obj.intensity = 1.5f; obj.shadows = (LightShadows)0; } } internal static class TokenArt { private const int Segments = 48; private const int TextureSize = 256; private static readonly Color Gold = new Color(1f, 0.8f, 0.22f); private static readonly Color GoldBright = new Color(1f, 0.92f, 0.5f); private static readonly Color GoldDark = new Color(0.72f, 0.5f, 0.08f); private static readonly Color Ink = new Color(0.2f, 0.1f, 0.02f); public static Mesh BuildCoinMesh() { //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) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_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_0147: 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_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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: 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) //IL_01c8: 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) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Expected O, but got Unknown int num = 49; Vector3[] array = (Vector3[])(object)new Vector3[2 * (num + 1) + 2 * num]; Vector3[] array2 = (Vector3[])(object)new Vector3[array.Length]; Vector2[] array3 = (Vector2[])(object)new Vector2[array.Length]; int[] array4 = new int[576]; int num2 = 0; int num3 = num + 1; int num4 = 2 * (num + 1); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0.96000004f); array[num2] = new Vector3(0f, 0.5f, 0f); array2[num2] = Vector3.up; array3[num2] = new Vector2(0.5f, 0.5f); array[num3] = new Vector3(0f, -0.5f, 0f); array2[num3] = Vector3.down; array3[num3] = new Vector2(0.5f, 0.5f); for (int i = 0; i < num; i++) { float num5 = (float)i * MathF.PI * 2f / 48f; float num6 = Mathf.Cos(num5) * 0.5f; float num7 = Mathf.Sin(num5) * 0.5f; int num8 = num2 + 1 + i; array[num8] = new Vector3(num6, 0.5f, num7); array2[num8] = Vector3.up; array3[num8] = new Vector2(0.5f + num6, 0.5f + num7); int num9 = num3 + 1 + i; array[num9] = new Vector3(num6, -0.5f, num7); array2[num9] = Vector3.down; array3[num9] = new Vector2(0.5f - num6, 0.5f + num7); Vector3 val2 = new Vector3(num6, 0f, num7); Vector3 normalized = ((Vector3)(ref val2)).normalized; int num10 = num4 + i * 2; array[num10] = new Vector3(num6, 0.5f, num7); array2[num10] = normalized; array3[num10] = val; array[num10 + 1] = new Vector3(num6, -0.5f, num7); array2[num10 + 1] = normalized; array3[num10 + 1] = val; } int num11 = 0; for (int j = 0; j < 48; j++) { array4[num11++] = num2; array4[num11++] = num2 + 2 + j; array4[num11++] = num2 + 1 + j; array4[num11++] = num3; array4[num11++] = num3 + 1 + j; array4[num11++] = num3 + 2 + j; int num12 = num4 + j * 2; array4[num11++] = num12; array4[num11++] = num12 + 2; array4[num11++] = num12 + 1; array4[num11++] = num12 + 1; array4[num11++] = num12 + 2; array4[num11++] = num12 + 3; } Mesh val3 = new Mesh { name = "Token Pirata", vertices = array, normals = array2, uv = array3, triangles = array4 }; val3.RecalculateBounds(); ((Object)val3).hideFlags = (HideFlags)61; return val3; } public static Material BuildMaterial(Material baseMaterial) { //IL_001b: 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_0021: Expected O, but got Unknown //IL_007f: 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_013f: Unknown result type (might be due to invalid IL or missing references) Material val = (((Object)(object)baseMaterial != (Object)null) ? new Material(baseMaterial) : new Material(Shader.Find("Standard"))); ((Object)val).name = "Token Pirata"; ((Object)val).hideFlags = (HideFlags)61; Texture2D val2 = BuildTexture(); if (val.HasProperty("_MainTex")) { val.SetTexture("_MainTex", (Texture)(object)val2); } if (val.HasProperty("_BaseMap")) { val.SetTexture("_BaseMap", (Texture)(object)val2); } if (val.HasProperty("_Color")) { val.SetColor("_Color", Color.white); } if (val.HasProperty("_BaseColor")) { val.SetColor("_BaseColor", Color.white); } if (val.HasProperty("_BumpMap")) { val.SetTexture("_BumpMap", (Texture)null); } if (val.HasProperty("_MetallicGlossMap")) { val.SetTexture("_MetallicGlossMap", (Texture)null); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0.8f); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.7f); } if (val.HasProperty("_EmissionColor")) { val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", new Color(0.45f, 0.32f, 0.06f)); if (val.HasProperty("_EmissionMap")) { val.SetTexture("_EmissionMap", (Texture)(object)val2); } } return val; } private static Texture2D BuildTexture() { //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_001c: 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_002c: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(256, 256, (TextureFormat)4, true) { name = "Token Pirata", wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; Color[] array = (Color[])(object)new Color[65536]; Vector2 p = default(Vector2); for (int i = 0; i < 256; i++) { for (int j = 0; j < 256; j++) { ((Vector2)(ref p))..ctor(((float)j + 0.5f) / 256f * 2f - 1f, ((float)i + 0.5f) / 256f * 2f - 1f); array[i * 256 + j] = Shade(p); } } val.SetPixels(array); val.Apply(true, true); return val; } private static Color Shade(Vector2 p) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_003b: 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_001e: 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_0062: 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) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00fa: 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_00f8: 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_0116: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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_0128: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_019e: 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) float magnitude = ((Vector2)(ref p)).magnitude; if (magnitude > 0.86f) { return GoldBright; } if (magnitude > 0.8f) { return GoldDark; } Color result = Color.Lerp(GoldBright, Gold, magnitude / 0.8f); bool num = Circle(p, new Vector2(-0.15f, 0.12f), 0.1f) || Circle(p, new Vector2(0.15f, 0.12f), 0.1f); bool flag = Circle(p, new Vector2(0f, -0.06f), 0.045f); bool flag2 = p.y < -0.2f && p.y > -0.37f && (Mathf.Abs(p.x + 0.09f) < 0.015f || Mathf.Abs(p.x) < 0.015f || Mathf.Abs(p.x - 0.09f) < 0.015f); if (num || flag || flag2) { return result; } bool num2 = Circle(p, new Vector2(0f, 0.12f), 0.36f) || (Mathf.Abs(p.x) < 0.19f && p.y < 0f && p.y > -0.36f); bool flag3 = Bone(p, new Vector2(-0.52f, -0.5f), new Vector2(0.52f, 0.4f)) || Bone(p, new Vector2(0.52f, -0.5f), new Vector2(-0.52f, 0.4f)); if (!(num2 || flag3)) { return result; } return Ink; } private static bool Circle(Vector2 p, Vector2 center, float radius) { //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) Vector2 val = p - center; return ((Vector2)(ref val)).sqrMagnitude < radius * radius; } private static bool Bone(Vector2 p, Vector2 a, Vector2 b) { //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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_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_0036: 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_004e: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_0095: 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) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00ab: Unknown result type (might be due to invalid IL or missing references) Vector2 val = b - a; float num = Mathf.Clamp01(Vector2.Dot(p - a, val) / ((Vector2)(ref val)).sqrMagnitude); Vector2 val2 = p - (a + val * num); if (((Vector2)(ref val2)).sqrMagnitude < 0.003025f) { return true; } val2 = new Vector2(0f - val.y, val.x); Vector2 val3 = ((Vector2)(ref val2)).normalized * 0.06f; if (!Circle(p, a + val3, 0.075f) && !Circle(p, a - val3, 0.075f) && !Circle(p, b + val3, 0.075f)) { return Circle(p, b - val3, 0.075f); } return true; } } }