Decompiled source of IvoryPeak v0.4.1
BepInEx/plugins/IvoryPeak/IvoryPeak.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Peak; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.LowLevel; using UnityEngine.PlayerLoop; using UnityEngine.Rendering; using UnityEngine.UI; using Zorro.Core; [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("IvoryPeak")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("IvoryPeak")] [assembly: AssemblyTitle("IvoryPeak")] [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 IvoryPeak { public class Balanco { private class Mola { public Transform pai; public Transform[] ossos; public Quaternion[] restRot; public Vector3[] restCauda; public float[] comp; public Vector3[] p; public Vector3[] pp; public Vector3[] alvo; public float limite; public float rigidez; public float gravidade; public bool colide; public bool iniciado; public Vector3 paiAnt; } private const float Passo1 = 1f / 60f; private const float Amortecer = 0.12f; private const float Seguir = 0.85f; private readonly List<Mola> molas = new List<Mola>(); private readonly List<(Transform a, Transform b, float r)> capsulas = new List<(Transform, Transform, float)>(); private float acumulado; public int Cadeias => molas.Count; public Balanco(DadosFisica d, Dictionary<string, Transform> ossos) { //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_024d: 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_02b2: 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_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0272: 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_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) if (d.capsulas != null) { Capsula[] array = d.capsulas; foreach (Capsula capsula in array) { if (ossos.TryGetValue(capsula.a, out var value) && ossos.TryGetValue(capsula.b, out var value2)) { capsulas.Add((value, value2, capsula.raio)); } } } if (d.cadeias == null) { return; } Cadeia[] cadeias = d.cadeias; foreach (Cadeia cadeia in cadeias) { if (!ossos.TryGetValue(cadeia.pai, out var value3)) { continue; } List<Transform> list = new List<Transform>(); string[] ossos2 = cadeia.ossos; foreach (string key in ossos2) { if (ossos.TryGetValue(key, out var value4)) { list.Add(value4); } } if (list.Count == 0 || list.Count != cadeia.ossos.Length) { continue; } int count = list.Count; Mola mola = new Mola { pai = value3, ossos = list.ToArray(), restRot = (Quaternion[])(object)new Quaternion[count], restCauda = (Vector3[])(object)new Vector3[count], comp = new float[count], p = (Vector3[])(object)new Vector3[count + 1], pp = (Vector3[])(object)new Vector3[count + 1], alvo = (Vector3[])(object)new Vector3[count + 1], limite = cadeia.limite, colide = cadeia.colide, rigidez = Mathf.Lerp(0.3f, 0.05f, cadeia.gravidade), gravidade = 9.81f * cadeia.gravidade * 6f }; for (int k = 0; k < count; k++) { mola.restRot[k] = list[k].localRotation; Vector3 val; if (k < count - 1) { val = list[k + 1].position; } else { float num = ((count > 1) ? Vector3.Distance(list[k - 1].position, list[k].position) : 0.08f); Vector3 val2 = list[k].up; if (count > 1) { Vector3 val3 = list[k].position - list[k - 1].position; Vector3 normalized = ((Vector3)(ref val3)).normalized; if (Vector3.Dot(list[k - 1].up, normalized) < 0.9f) { val2 = normalized; } } val = list[k].position + val2 * num; } mola.restCauda[k] = list[k].InverseTransformPoint(val); mola.comp[k] = Vector3.Distance(list[k].position, val); } molas.Add(mola); } } public void Passo(float dt) { dt = Mathf.Clamp(dt, 0f, 0.1f); acumulado = Mathf.Min(acumulado + dt, 1f / 15f); int num = 0; while (acumulado >= 1f / 60f) { acumulado -= 1f / 60f; num++; } foreach (Mola mola in molas) { Mola1(mola, num); } } private void Mola1(Mola m, int passos) { //IL_001f: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0109: 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_0110: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: 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_01c2: 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_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: 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_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: 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_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: 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_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) int num = m.ossos.Length; for (int i = 0; i < num; i++) { m.ossos[i].localRotation = m.restRot[i]; } m.alvo[0] = m.ossos[0].position; for (int j = 0; j < num; j++) { m.alvo[j + 1] = m.ossos[j].TransformPoint(m.restCauda[j]); } Vector3 position = m.pai.position; if (m.iniciado) { Vector3 val = position - m.paiAnt; if (!(((Vector3)(ref val)).sqrMagnitude > 4f)) { goto IL_0109; } } for (int k = 0; k <= num; k++) { m.p[k] = m.alvo[k]; m.pp[k] = m.alvo[k]; } m.iniciado = true; m.paiAnt = position; goto IL_0109; IL_0109: Vector3 val2 = (position - m.paiAnt) * 0.85f; m.paiAnt = position; for (int l = 1; l <= num; l++) { ref Vector3 reference = ref m.p[l]; reference += val2; ref Vector3 reference2 = ref m.pp[l]; reference2 += val2; } m.p[0] = m.alvo[0]; float lim = m.limite * (MathF.PI / 180f); for (int n = 0; n < passos; n++) { for (int num2 = 1; num2 <= num; num2++) { Vector3 val3 = (m.p[num2] - m.pp[num2]) * 0.88f; m.pp[num2] = m.p[num2]; ref Vector3 reference3 = ref m.p[num2]; reference3 += val3 + Vector3.down * (m.gravidade * (1f / 60f) * (1f / 60f)); ref Vector3 reference4 = ref m.p[num2]; reference4 += (m.alvo[num2] - m.p[num2]) * m.rigidez; } Restringir(m, lim); } if (passos == 0) { Restringir(m, lim); } for (int num3 = 0; num3 < num; num3++) { Transform val4 = m.ossos[num3]; Vector3 val5 = val4.TransformPoint(m.restCauda[num3]) - val4.position; Vector3 val6 = m.p[num3 + 1] - val4.position; if (((Vector3)(ref val5)).sqrMagnitude > 1E-10f && ((Vector3)(ref val6)).sqrMagnitude > 1E-10f) { val4.rotation = Quaternion.FromToRotation(val5, val6) * val4.rotation; } } } private void Restringir(Mola m, float lim) { //IL_0017: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_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_005f: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_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_007f: 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_0091: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_0121: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_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_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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_01a3: Unknown result type (might be due to invalid IL or missing references) int num = m.ossos.Length; for (int i = 1; i <= num; i++) { Vector3 val = m.p[i] - m.p[i - 1]; Vector3 val2 = m.alvo[i] - m.alvo[i - 1]; if (((Vector3)(ref val)).sqrMagnitude < 1E-12f) { val = val2; } if (((Vector3)(ref val2)).sqrMagnitude > 1E-12f && Vector3.Angle(val, val2) > m.limite) { val = Vector3.RotateTowards(((Vector3)(ref val2)).normalized, ((Vector3)(ref val)).normalized, lim, 0f); } m.p[i] = m.p[i - 1] + ((Vector3)(ref val)).normalized * m.comp[i - 1]; if (!m.colide) { continue; } foreach (var capsula in capsulas) { m.p[i] = Empurra(m.p[i], capsula.a.position, capsula.b.position, capsula.r); } Vector3 val3 = m.p[i] - m.p[i - 1]; if (((Vector3)(ref val3)).sqrMagnitude > 1E-12f) { m.p[i] = m.p[i - 1] + ((Vector3)(ref val3)).normalized * m.comp[i - 1]; } } } private static Vector3 Empurra(Vector3 q, Vector3 a, Vector3 b, float r) { //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_002d: 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_0030: 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_003c: 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_005a: 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_005d: 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_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) Vector3 val = b - a; float num = Mathf.Clamp01(Vector3.Dot(q - a, val) / Mathf.Max(((Vector3)(ref val)).sqrMagnitude, 1E-09f)); Vector3 val2 = a + val * num; Vector3 val3 = q - val2; float magnitude = ((Vector3)(ref val3)).magnitude; if (magnitude >= r || magnitude < 1E-06f) { return q; } return val2 + val3 / magnitude * r; } } internal static class BotaoIvory { private static PassportManager dono; private static PassportManager falhouEm; private static GameObject raiz; private static RawImage icone; private static Image borda; private static TextMeshProUGUI titulo; private static TextMeshProUGUI valor; private static bool? mostrado; private static Texture2D texCor; private static Texture2D texApagada; private const float Caixa = 60f; private const float Folga = 12f; internal static bool Pronto(PassportManager pm) { if ((Object)(object)pm != (Object)null && (Object)(object)pm == (Object)(object)dono) { return (Object)(object)raiz != (Object)null; } return false; } internal static void Atualizar(PassportManager pm, Action alternar) { //IL_00af: 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) if ((Object)(object)pm == (Object)null || (Object)(object)pm == (Object)(object)falhouEm) { return; } if ((Object)(object)pm != (Object)(object)dono || (Object)(object)raiz == (Object)null) { try { Criar(pm, alternar); } catch (Exception ex) { falhouEm = pm; Limpar(); Plugin.Log.LogWarning((object)("botao do passaporte: " + ex.Message + " (usando o botao simples)")); return; } } bool value = Plugin.Ativo.Value; if (mostrado != value) { mostrado = value; ((Graphic)borda).color = (value ? pm.activeBorderColor : pm.inactiveBorderColor); icone.texture = (Texture)(object)(value ? texCor : texApagada); ((TMP_Text)valor).text = (value ? "Ivory" : "Scout"); } } private static void Limpar() { if ((Object)(object)raiz != (Object)null) { Object.Destroy((Object)(object)raiz); } raiz = null; dono = null; icone = null; borda = null; titulo = (valor = null); mostrado = null; } private static void Criar(PassportManager pm, Action alternar) { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_014d: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown //IL_0198: 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_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: 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_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Expected O, but got Unknown //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) Limpar(); Texturas(); PassportButton medalButton = pm.medalButton; if ((Object)(object)medalButton == (Object)null) { throw new Exception("sem medalButton"); } Transform parent = ((Component)medalButton).transform.parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); if ((Object)(object)val == (Object)null) { throw new Exception("medalButton sem pai"); } raiz = Object.Instantiate<GameObject>(((Component)medalButton).gameObject, (Transform)(object)val, false); ((Object)raiz).name = "UI_IvoryToggle"; PassportButton component = raiz.GetComponent<PassportButton>(); if ((Object)(object)component == (Object)null || (Object)(object)component.icon == (Object)null || (Object)(object)component.border == (Object)null) { throw new Exception("PassportButton mudou"); } icone = component.icon; borda = component.border; if ((Object)(object)component.lockedIcon != (Object)null) { ((Component)component.lockedIcon).gameObject.SetActive(false); } Object.Destroy((Object)(object)component); Button component2 = raiz.GetComponent<Button>(); if ((Object)(object)component2 == (Object)null) { throw new Exception("sem Button"); } component2.onClick = new ButtonClickedEvent(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { alternar(); }); ((Component)icone).gameObject.SetActive(true); ((Graphic)icone).material = null; ((Graphic)icone).color = Color.white; icone.uvRect = new Rect(0f, 0f, 1f, 1f); RectTransform val2 = (RectTransform)raiz.transform; RectTransform val3 = (RectTransform)((Component)medalButton).transform; float num = ((Transform)val3).localPosition.x - 171.3f; Transform obj = ((Transform)val).Find("Portrait"); RectTransform val4 = (RectTransform)(object)((obj is RectTransform) ? obj : null); if ((Object)(object)val4 != (Object)null) { Vector3[] array = (Vector3[])(object)new Vector3[4]; val4.GetWorldCorners(array); num = ((Transform)val).InverseTransformPoint(array[0]).x + 30f; } val2.anchoredPosition = val3.anchoredPosition + new Vector2(num - ((Transform)val3).localPosition.x, 0f); Transform obj2 = (((Object)(object)pm.nameText != (Object)null) ? ((TMP_Text)pm.nameText).transform.parent : null); if ((Object)(object)obj2 == (Object)null) { throw new Exception("sem nameText"); } GameObject val5 = Object.Instantiate<GameObject>(((Component)obj2).gameObject, raiz.transform, false); ((Object)val5).name = "IvoryLabel"; LocalizedText[] componentsInChildren = val5.GetComponentsInChildren<LocalizedText>(true); for (int num2 = 0; num2 < componentsInChildren.Length; num2++) { Object.DestroyImmediate((Object)(object)componentsInChildren[num2]); } Transform val6 = val5.transform.Find("Title"); Transform val7 = val5.transform.Find("Text"); titulo = (((Object)(object)val6 != (Object)null) ? ((Component)val6).GetComponent<TextMeshProUGUI>() : null); valor = (((Object)(object)val7 != (Object)null) ? ((Component)val7).GetComponent<TextMeshProUGUI>() : null); if ((Object)(object)titulo == (Object)null || (Object)(object)valor == (Object)null) { throw new Exception("campo do nome mudou"); } ((TMP_Text)titulo).text = Titulo(); (TextMeshProUGUI, float, float)[] array2 = new(TextMeshProUGUI, float, float)[2] { (titulo, 95f, 24f), (valor, 80f, 32f) }; for (int num2 = 0; num2 < array2.Length; num2++) { var (val8, num3, num4) = array2[num2]; ((Graphic)val8).raycastTarget = true; ((TMP_Text)val8).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)val8).overflowMode = (TextOverflowModes)0; ((TMP_Text)val8).rectTransform.sizeDelta = new Vector2(num3, num4); } RectTransform val9 = (RectTransform)val5.transform; Vector2 val10 = default(Vector2); ((Vector2)(ref val10))..ctor(0.5f, 0.5f); val9.pivot = val10; Vector2 anchorMin = (val9.anchorMax = val10); val9.anchorMin = anchorMin; Rect rect = val9.rect; val9.anchoredPosition = new Vector2(42f + ((Rect)(ref rect)).width / 2f, -4f); ((Transform)val9).localScale = Vector3.one; dono = pm; mostrado = null; raiz.SetActive(true); Plugin.Log.LogInfo((object)("botao do passaporte pronto (" + ((TMP_Text)titulo).text + ")")); } private static string Titulo() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected I4, but got Unknown switch ((int)LocalizedText.CURRENT_LANGUAGE) { case 1: return "Personnage"; case 2: return "Personaggio"; case 3: return "Charakter"; case 4: case 5: return "Personaje"; case 6: return "Personagem"; case 7: case 8: return "Персонаж"; case 9: case 10: return "角色"; case 11: return "キャラクター"; case 12: return "캐릭터"; default: return "Character"; } } private static void Texturas() { //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_00e5: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_0171: 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) if ((Object)(object)texCor != (Object)null && (Object)(object)texApagada != (Object)null) { return; } byte[] array; using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("IvoryPeak.ivory_botao.png")) { if (stream == null) { throw new Exception("ivory_botao.png nao esta na dll"); } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); array = memoryStream.ToArray(); } texCor = Nova("IvoryBotao", 2, 2); if (!ImageConversion.LoadImage(texCor, array, false)) { throw new Exception("ivory_botao.png ilegivel"); } Color32[] pixels = texCor.GetPixels32(); Color val = default(Color); ((Color)(ref val))..ctor(0.46f, 0.42f, 0.35f); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.8f, 0.76f, 0.67f); for (int i = 0; i < pixels.Length; i++) { Color32 val3 = pixels[i]; float num = (0.299f * (float)(int)val3.r + 0.587f * (float)(int)val3.g + 0.114f * (float)(int)val3.b) / 255f; Color val4 = Color.Lerp(val, val2, Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.1f, 0.85f, num))); pixels[i] = new Color32((byte)(val4.r * 255f), (byte)(val4.g * 255f), (byte)(val4.b * 255f), val3.a); } texApagada = Nova("IvoryBotaoOff", ((Texture)texCor).width, ((Texture)texCor).height); texApagada.SetPixels32(pixels); texApagada.Apply(true, true); texCor.Apply(true, true); } private static Texture2D Nova(string nome, int w, int h) { //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_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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown return new Texture2D(w, h, (TextureFormat)4, true) { name = nome, wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)2, anisoLevel = 2, hideFlags = (HideFlags)61 }; } } internal sealed class CartasJogo { private static readonly int MainTex = Shader.PropertyToID("_MainTex"); private static readonly int EyePos = Shader.PropertyToID("_EyePosition"); private static readonly int BaseScale = Shader.PropertyToID("_BaseScale"); private static readonly int TalkSprite = Shader.PropertyToID("_TalkSprite"); private readonly List<Renderer> olhos = new List<Renderer>(); private Renderer boca; private readonly Dictionary<Renderer, Quaternion> rotOrig = new Dictionary<Renderer, Quaternion>(); private readonly Dictionary<Renderer, float> escalaOrig = new Dictionary<Renderer, float>(); private readonly Dictionary<Renderer, Texture> texOrig = new Dictionary<Renderer, Texture>(); private HashSet<Texture> cosmOlhos; private HashSet<Texture> cosmBocas; private Texture primeiroOlho; private Texture primeiraBoca; internal bool TemBoca => (Object)(object)boca != (Object)null; internal IEnumerable<Renderer> Renderers { get { foreach (Renderer olho in olhos) { yield return olho; } if ((Object)(object)boca != (Object)null) { yield return boca; } } } internal static CartasJogo Criar(CustomizationRefs refs, out string motivo) { motivo = null; if (Plugin.Mascaras.Count == 0) { motivo = "mascaras do rosto nao carregaram"; return null; } if ((Object)(object)refs == (Object)null || refs.EyeRenderers == null) { motivo = "sem EyeRenderers"; return null; } CartasJogo cartasJogo = new CartasJogo(); Transform val = (((Object)(object)refs.thirdEye != (Object)null) ? refs.thirdEye.transform : null); Renderer[] eyeRenderers = refs.EyeRenderers; foreach (Renderer val2 in eyeRenderers) { if (!((Object)(object)val2 == (Object)null) && (!((Object)(object)val != (Object)null) || !((Component)val2).transform.IsChildOf(val)) && ((Object)val2).name.IndexOf("Third", StringComparison.OrdinalIgnoreCase) < 0) { Material sharedMaterial = val2.sharedMaterial; if ((Object)(object)sharedMaterial != (Object)null && sharedMaterial.HasProperty(MainTex) && sharedMaterial.HasProperty(EyePos) && (Object)(object)((Component)val2).transform.parent != (Object)null) { cartasJogo.olhos.Add(val2); } } } if (cartasJogo.olhos.Count != 2) { motivo = "cartas de olho do scout: " + cartasJogo.olhos.Count; return null; } Renderer mouthRenderer = refs.mouthRenderer; if (Plugin.BocaJogo.Value && (Object)(object)mouthRenderer != (Object)null && (Object)(object)mouthRenderer.sharedMaterial != (Object)null && mouthRenderer.sharedMaterial.HasProperty(MainTex) && mouthRenderer.sharedMaterial.HasProperty(TalkSprite) && (Object)(object)((Component)mouthRenderer).transform.parent != (Object)null) { cartasJogo.boca = mouthRenderer; } cartasJogo.Cosmeticos(); return cartasJogo; } private void Cosmeticos() { cosmOlhos = new HashSet<Texture>(); cosmBocas = new HashSet<Texture>(); Customization instance = Singleton<Customization>.Instance; if ((Object)(object)instance == (Object)null) { return; } CustomizationOption[] eyes; if (instance.eyes != null) { eyes = instance.eyes; foreach (CustomizationOption val in eyes) { if ((Object)(object)val != (Object)null && (Object)(object)val.texture != (Object)null) { cosmOlhos.Add(val.texture); if (primeiroOlho == null) { primeiroOlho = val.texture; } } } } if (instance.mouths == null) { return; } eyes = instance.mouths; foreach (CustomizationOption val2 in eyes) { if ((Object)(object)val2 != (Object)null && (Object)(object)val2.texture != (Object)null) { cosmBocas.Add(val2.texture); if (primeiraBoca == null) { primeiraBoca = val2.texture; } } } } internal void Montar() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_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) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; foreach (Renderer olho in olhos) { val += ((Component)olho).transform.rotation * Vector3.left; } ((Vector3)(ref val)).Normalize(); foreach (Renderer olho2 in olhos) { rotOrig[olho2] = ((Component)olho2).transform.localRotation; Mirar(((Component)olho2).transform, val, Plugin.OlhoGiro.Value, Plugin.OlhoAltura.Value); olho2.forceRenderingOff = false; Material material = olho2.material; if (material.HasProperty(BaseScale)) { escalaOrig[olho2] = material.GetFloat(BaseScale); material.SetFloat(BaseScale, Plugin.OlhoEscala.Value); } } if ((Object)(object)boca != (Object)null) { rotOrig[boca] = ((Component)boca).transform.localRotation; Mirar(((Component)boca).transform, val, 0f, Plugin.BocaAltura.Value); boca.forceRenderingOff = false; } } private static void Mirar(Transform t, Vector3 frente, float giro, float altura) { //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_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_0017: 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_0030: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0046: 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_004c: 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) //IL_0053: 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_00a1: 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_00a3: 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_0072: 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_00c6: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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) //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_00ed: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) Vector3 up = t.parent.up; Vector3 val = t.rotation * Vector3.left; if (Mathf.Abs(giro) > 0.001f) { Quaternion val2 = Quaternion.AngleAxis(Mathf.Abs(giro), up); Quaternion val3 = Quaternion.AngleAxis(0f - Mathf.Abs(giro), up); bool flag = Vector3.Angle(val2 * val, frente) > Vector3.Angle(val3 * val, frente); Quaternion val4 = ((giro > 0f == flag) ? val2 : val3); t.rotation = val4 * t.rotation; val = val4 * val; } if (Mathf.Abs(altura) > 0.001f) { Vector3 val5 = Vector3.Cross(val, up); if (!(((Vector3)(ref val5)).sqrMagnitude < 1E-08f)) { ((Vector3)(ref val5)).Normalize(); Quaternion val6 = Quaternion.AngleAxis(Mathf.Abs(altura), val5); Quaternion val7 = Quaternion.AngleAxis(0f - Mathf.Abs(altura), val5); bool flag2 = Vector3.Dot(val6 * val, up) > Vector3.Dot(val7 * val, up); t.rotation = ((altura > 0f == flag2) ? val6 : val7) * t.rotation; } } } internal void Aplicar(Texture olho, Texture tBoca) { foreach (Renderer olho2 in olhos) { Trocar(olho2, olho, cosmOlhos); } if ((Object)(object)boca != (Object)null) { Trocar(boca, tBoca, cosmBocas); } } private void Trocar(Renderer r, Texture nova, HashSet<Texture> cosm) { if ((Object)(object)r == (Object)null || (Object)(object)nova == (Object)null) { return; } Material material = r.material; Texture texture = material.GetTexture(MainTex); if ((Object)(object)texture == (Object)(object)nova) { return; } bool flag = (Object)(object)texture != (Object)null && Plugin.TexRosto.Contains(texture); if (flag || !((Object)(object)texture != (Object)null) || cosm.Contains(texture)) { if (!flag && (Object)(object)texture != (Object)null) { texOrig[r] = texture; } material.SetTexture(MainTex, nova); } } internal void Desmontar() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<Renderer, Quaternion> item in rotOrig) { if ((Object)(object)item.Key != (Object)null) { ((Component)item.Key).transform.localRotation = item.Value; } } foreach (Renderer renderer in Renderers) { if ((Object)(object)renderer == (Object)null) { continue; } try { Material material = renderer.material; if (escalaOrig.TryGetValue(renderer, out var value)) { material.SetFloat(BaseScale, value); } Texture texture = material.GetTexture(MainTex); if ((Object)(object)texture != (Object)null && Plugin.TexRosto.Contains(texture)) { texOrig.TryGetValue(renderer, out var value2); if ((Object)(object)value2 == (Object)null) { value2 = (((Object)(object)renderer == (Object)(object)boca) ? primeiraBoca : primeiroOlho); } if ((Object)(object)value2 != (Object)null) { material.SetTexture(MainTex, value2); } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("cartas do rosto ao desligar: " + ex.Message)); } } rotOrig.Clear(); escalaOrig.Clear(); texOrig.Clear(); } } public class Gerente : MonoBehaviour { public const string Chave = "ivory_on"; private float espera; private bool? enviado; private object salaEnviada; private bool erroLogado; private bool erroTecla; private bool erroBotao; private Action alternarPassaporte; private readonly List<Character> lista = new List<Character>(); private string avisoTexto; private float avisoAte; private GUIStyle estiloBotao; private GUIStyle estiloAviso; private Texture2D fundoOn; private Texture2D fundoOff; private Texture2D fundoAviso; private Key? teclaCache; private string teclaNome; private static readonly FieldInfo FonteEstatua = typeof(PetrifiedScout).GetField("spawnedFromCharacter", BindingFlags.Instance | BindingFlags.NonPublic); private void Awake() { try { Laco.Instalar(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("PlayerLoop: " + ex.Message)); } } public void Alternar() { Alternar(aviso: true); } public void Alternar(bool aviso) { try { Plugin instancia = Plugin.Instancia; if (instancia != null) { ((BaseUnityPlugin)instancia).Config.Reload(); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("reler o .cfg: " + ex.Message)); } Plugin.Ativo.Value = !Plugin.Ativo.Value; if (aviso) { avisoTexto = (Plugin.Ativo.Value ? "Ivory: ON" : "Ivory: OFF"); avisoAte = Time.unscaledTime + 2f; } espera = 0f; Plugin.Log.LogInfo((object)("Ivory " + (Plugin.Ativo.Value ? "ligada" : "desligada"))); } private void Update() { Teclado(); try { PassportManager instance = PassportManager.instance; if ((Object)(object)instance != (Object)null && ((MenuWindow)instance).isOpen) { BotaoIvory.Atualizar(instance, delegate { Alternar(aviso: false); }); } } catch (Exception ex) { if (!erroBotao) { Plugin.Log.LogWarning((object)("botao do passaporte: " + ex)); erroBotao = true; } } espera -= Time.unscaledDeltaTime; if (espera > 0f) { return; } espera = 0.5f; try { if (Laco.Ativos.Count > 0 && !Laco.Rodando) { Laco.Instalar(); } Sincronizar(); lista.Clear(); lista.AddRange(Character.AllCharacters); foreach (Character listum in lista) { if (!((Object)(object)listum == (Object)null) && !listum.isBot) { Aplicar(((Component)listum).gameObject, Quer(listum)); } } PassportManager instance2 = PassportManager.instance; if ((Object)(object)instance2 != (Object)null && (Object)(object)instance2.dummy != (Object)null) { Aplicar(((Component)instance2.dummy).gameObject, Plugin.Ativo.Value); } PetrifiedScout[] array = Object.FindObjectsByType<PetrifiedScout>((FindObjectsSortMode)0); foreach (PetrifiedScout val in array) { if (!((Object)(object)val == (Object)null)) { Character val2 = (Character)((FonteEstatua != null) ? /*isinst with value type is only supported in some contexts*/: null); Aplicar(((Component)val).gameObject, (Object)(object)val2 != (Object)null && Quer(val2)); } } } catch (Exception ex2) { if (!erroLogado) { Plugin.Log.LogError((object)("Gerente: " + ex2)); erroLogado = true; } } } private static void Aplicar(GameObject go, bool quer) { IvoryAvatar component = go.GetComponent<IvoryAvatar>(); if (quer && (Object)(object)component == (Object)null) { if (!IvoryAvatar.Falhas.TryGetValue(((Object)go).GetInstanceID(), out var value) || value < 3) { go.AddComponent<IvoryAvatar>(); } } else if (!quer && (Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } } private void Teclado() { //IL_0045: 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_0053: Unknown result type (might be due to invalid IL or missing references) try { string text = Plugin.Tecla.Value?.Trim(); if (string.IsNullOrEmpty(text)) { return; } if (text != teclaNome) { teclaNome = text; teclaCache = ((Enum.TryParse<Key>(text, ignoreCase: true, out Key result) && (int)result != 0) ? new Key?(result) : ((Key?)null)); if (!teclaCache.HasValue) { Plugin.Log.LogWarning((object)("ToggleKey invalida: " + text)); } } Keyboard current = Keyboard.current; if (teclaCache.HasValue && current != null && ((ButtonControl)current[teclaCache.Value]).wasPressedThisFrame) { Alternar(); } } catch (Exception ex) { if (!erroTecla) { Plugin.Log.LogWarning((object)("ToggleKey: " + ex.Message)); erroTecla = true; } } } private static bool Quer(Character c) { if ((Object)(object)c.data != (Object)null && c.data.isScoutmaster) { return false; } if (c.isZombie) { Player val = null; try { val = c.refs?.customization?.overridePhotonPlayer; } catch { } if (val == null) { return false; } if (val.IsLocal) { return Plugin.Ativo.Value; } return Marcado(val); } PhotonView photonView = ((MonoBehaviourPun)c).photonView; if ((Object)(object)photonView == (Object)null) { return false; } if (c.IsLocal || photonView.IsMine) { return Plugin.Ativo.Value; } return Marcado(photonView.Owner); } private static bool Marcado(Player p) { bool flag = default(bool); int num; if (p != null && p.CustomProperties != null && ((Dictionary<object, object>)(object)p.CustomProperties).TryGetValue((object)"ivory_on", out object value)) { if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } private void Sincronizar() { //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_0096: Expected O, but got Unknown //IL_009d: Expected O, but got Unknown Player localPlayer = PhotonNetwork.LocalPlayer; if (localPlayer == null) { return; } bool value = Plugin.Ativo.Value; object currentRoom = PhotonNetwork.CurrentRoom; object value2; bool flag = localPlayer.CustomProperties != null && ((Dictionary<object, object>)(object)localPlayer.CustomProperties).TryGetValue((object)"ivory_on", out value2) && value2 is bool flag2 && flag2 == value; if (enviado != value || currentRoom != salaEnviada) { if (!flag) { Hashtable val = new Hashtable(); ((Dictionary<object, object>)val).Add((object)"ivory_on", (object)value); localPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } enviado = value; salaEnviada = currentRoom; } } private static Texture2D Cor(Color c) { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1) { hideFlags = (HideFlags)61 }; val.SetPixel(0, 0, c); val.Apply(); return val; } private void Estilos() { //IL_001e: 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_0066: 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_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_00a0: Expected O, but got Unknown //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) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) if (estiloBotao == null) { fundoOn = Cor(new Color(0.16f, 0.52f, 0.3f, 0.95f)); fundoOff = Cor(new Color(0.25f, 0.25f, 0.28f, 0.95f)); fundoAviso = Cor(new Color(0f, 0f, 0f, 0.6f)); estiloBotao = new GUIStyle(GUI.skin.button) { fontSize = 22, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; GUIStyleState normal = estiloBotao.normal; GUIStyleState hover = estiloBotao.hover; Color val = (estiloBotao.active.textColor = Color.white); Color textColor = (hover.textColor = val); normal.textColor = textColor; estiloAviso = new GUIStyle(GUI.skin.label) { fontSize = 24, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; estiloAviso.normal.textColor = Color.white; estiloAviso.normal.background = fundoAviso; } } private void OnGUI() { //IL_0145: 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) try { Estilos(); float num = (float)Screen.height / 1080f; PassportManager instance = PassportManager.instance; if ((Object)(object)instance != (Object)null && ((MenuWindow)instance).isOpen && !BotaoIvory.Pronto(instance)) { bool value = Plugin.Ativo.Value; GUIStyleState normal = estiloBotao.normal; GUIStyleState hover = estiloBotao.hover; Texture2D val = (estiloBotao.active.background = (value ? fundoOn : fundoOff)); Texture2D background = (hover.background = val); normal.background = background; estiloBotao.fontSize = Mathf.RoundToInt(22f * num); if (GUI.Button(new Rect((float)Screen.width - 300f * num, 40f * num, 260f * num, 56f * num), value ? "IVORY: ON" : "IVORY: OFF", estiloBotao)) { Alternar(); } } if (avisoTexto != null && Time.unscaledTime < avisoAte) { estiloAviso.fontSize = Mathf.RoundToInt(24f * num); GUI.Label(new Rect(((float)Screen.width - 260f * num) / 2f, 90f * num, 260f * num, 48f * num), avisoTexto, estiloAviso); } } catch { } } } [DefaultExecutionOrder(31000)] public class IvoryAvatar : MonoBehaviour { private static readonly int MainTex = Shader.PropertyToID("_MainTex"); private static readonly int BaseMap = Shader.PropertyToID("_BaseMap"); private static readonly int Ghost = Shader.PropertyToID("_VertexGhost"); private static readonly int SkinColor = Shader.PropertyToID("_SkinColor"); private static readonly int StatusGlow = Shader.PropertyToID("_StatusGlow"); private static readonly int StatusColor = Shader.PropertyToID("_StatusColor"); private static readonly int Opacity = Shader.PropertyToID("_Opacity"); private static readonly int Tint = Shader.PropertyToID("_Tint"); private static readonly int Petrify = Shader.PropertyToID("_Petrify"); private const float EscalaScout = 0.33078676f; private const float CorteRosto = 0.45f; private const float RaioCabeca = 0.42f; private static readonly Color CorPedra = new Color(0.56f, 0.55f, 0.53f); private static readonly FieldInfo CampoEmote = typeof(CharacterAnimations).GetField("emoting", BindingFlags.Instance | BindingFlags.NonPublic); internal static readonly Dictionary<int, int> Falhas = new Dictionary<int, int>(); private Character ch; private PlayerCustomizationDummy boneco; private bool estatua; private Renderer estatuaCorpo; private CustomizationRefs refs; private bool rostoPerto; private Transform cabecaScout; private Transform cabecaIvory; private GameObject raiz; private Transform[] parScout; private Transform[] parIvory; private SkinnedMeshRenderer corpo; private SkinnedMeshRenderer costas; private SkinnedMeshRenderer olhos; private SkinnedMeshRenderer boca; private readonly List<SkinnedMeshRenderer> sombras = new List<SkinnedMeshRenderer>(); private readonly List<Renderer> escondidos = new List<Renderer>(); private readonly List<Renderer> pedraJogo = new List<Renderer>(); private readonly List<Material> criados = new List<Material>(); private readonly List<Material> fantasmas = new List<Material>(); private readonly List<Material> espelhoStatus = new List<Material>(); private readonly List<Material> espelhoOpacidade = new List<Material>(); private readonly Dictionary<Material, Color> tintaBase = new Dictionary<Material, Color>(); private Material mOlhos; private Material mBoca; private Material mCor; private bool temFantasma; private bool pronto; private Balanco balanco; private float tentarEm; private float mochilaEm; private float corEm; private int tentativas; private bool mochila; private Color corAtual = new Color(-1f, -1f, -1f); private float glowAtual = -1f; private float opAtual = -1f; private float pedraAtual = -1f; private Color statusAtual = new Color(-1f, -1f, -1f); private float proxPisca; private float fimPisca; private string olhoAtual; private string bocaAtual; private CartasJogo cartas; private void Start() { Tentar(); } private void Tentar() { tentativas++; try { Montar(); pronto = true; } catch (Exception arg) { Desmontar(); if (tentativas >= 10) { Plugin.Log.LogError((object)$"IvoryAvatar desistiu em {((Object)this).name}: {arg}"); Falhas[((Object)((Component)this).gameObject).GetInstanceID()] = 99; ((Behaviour)this).enabled = false; } else { tentarEm = Time.time + 1f; } } } private void Montar() { //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Unknown result type (might be due to invalid IL or missing references) ch = ((Component)this).GetComponent<Character>(); boneco = (((Object)(object)ch == (Object)null) ? ((Component)this).GetComponent<PlayerCustomizationDummy>() : null); estatua = (Object)(object)boneco != (Object)null && (Object)(object)((Component)this).GetComponent<PetrifiedScout>() != (Object)null; refs = ((!((Object)(object)ch != (Object)null)) ? boneco?.refs : ch.refs?.customization?.refs); if ((Object)(object)refs == (Object)null || (Object)(object)refs.mainRenderer == (Object)null) { throw new Exception("CustomizationRefs ainda nao existe"); } Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>(); Transform[] bones = refs.mainRenderer.bones; foreach (Transform val in bones) { if ((Object)(object)val != (Object)null && !dictionary.ContainsKey(((Object)val).name)) { dictionary[((Object)val).name] = val; } } if (dictionary.Count < 100) { throw new Exception("esqueleto do scout incompleto: " + dictionary.Count); } estatuaCorpo = null; SkinnedMeshRenderer[] componentsInChildren; if (estatua) { componentsInChildren = ((Component)this).GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val2 in componentsInChildren) { if (((Object)val2).name == "Statue") { estatuaCorpo = (Renderer)(object)val2; break; } } } Transform val3 = (((Object)(object)((Component)refs).transform.parent != (Object)null) ? ((Component)refs).transform.parent : ((Component)refs).transform); raiz = Object.Instantiate<GameObject>(Plugin.Prefab, val3, false); ((Object)raiz).name = "IvoryPeak"; raiz.transform.localPosition = Vector3.zero; raiz.transform.localRotation = Quaternion.identity; float num = ((Component)refs).transform.lossyScale.x / 0.33078676f / Mathf.Max(val3.lossyScale.x, 1E-06f); raiz.transform.localScale = Vector3.one * (((Object)(object)val3 == (Object)(object)((Component)refs).transform) ? 3.0230956f : num); int layer = ((Component)refs.mainRenderer).gameObject.layer; Dictionary<string, Transform> dictionary2 = new Dictionary<string, Transform>(); List<Transform> list = new List<Transform>(); List<Transform> list2 = new List<Transform>(); bones = raiz.GetComponentsInChildren<Transform>(true); foreach (Transform val4 in bones) { ((Component)val4).gameObject.layer = layer; if (!dictionary2.ContainsKey(((Object)val4).name)) { dictionary2[((Object)val4).name] = val4; } if (dictionary.TryGetValue(((Object)val4).name, out var value)) { list.Add(value); list2.Add(val4); } } if (list2.Count < 100) { throw new Exception("rig da Ivory nao casou com o scout: " + list2.Count); } parScout = list.ToArray(); parIvory = list2.ToArray(); dictionary.TryGetValue("Head", out cabecaScout); dictionary2.TryGetValue("Head", out cabecaIvory); componentsInChildren = raiz.GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val5 in componentsInChildren) { if (((Object)val5).name == "Ivory_Corpo") { corpo = val5; } else if (((Object)val5).name == "Ivory_Costas") { costas = val5; } else if (((Object)val5).name == "Ivory_Olhos") { olhos = val5; } else if (((Object)val5).name == "Ivory_Boca") { boca = val5; } } if ((Object)(object)corpo == (Object)null) { throw new Exception("Ivory_Corpo ausente no prefab"); } corpo.updateWhenOffscreen = true; componentsInChildren = (SkinnedMeshRenderer[])(object)new SkinnedMeshRenderer[3] { costas, olhos, boca }; foreach (SkinnedMeshRenderer val6 in componentsInChildren) { if (!((Object)(object)val6 == (Object)null)) { val6.updateWhenOffscreen = false; ((Renderer)val6).localBounds = new Bounds(Vector3.zero, Vector3.one * 4f); } } if (Object.op_Implicit((Object)(object)olhos)) { ((Renderer)olhos).shadowCastingMode = (ShadowCastingMode)0; } if (Object.op_Implicit((Object)(object)boca)) { ((Renderer)boca).shadowCastingMode = (ShadowCastingMode)0; } Materiais(); Cartas(); Sombras(); ListaEscondidos(); Copiar(); if (Plugin.Fisica.Value && Plugin.Dados != null && !estatua) { balanco = new Balanco(Plugin.Dados, dictionary2); } proxPisca = Time.time + Random.Range(2f, 6f); string text = (((Object)(object)ch != (Object)null) ? "personagem" : (estatua ? "estatua" : "passaporte")); Plugin.Log.LogInfo((object)($"Ivory em {((Object)this).name} ({text}, local={(Object)(object)ch != (Object)null && ch.IsLocal}, zumbi={(Object)(object)ch != (Object)null && ch.isZombie}, " + $"ossos={list2.Count}, escala={raiz.transform.lossyScale.x:0.###}, shader do jogo={temFantasma || estatua}, " + "rosto=" + ((cartas != null) ? ("cartas do jogo" + (cartas.TemBoca ? " (olhos+boca)" : " (olhos)")) : NomeShader(mOlhos)) + ", " + $"balanco={((balanco != null) ? balanco.Cadeias : 0)} cadeias)")); } private void Cartas() { cartas = null; if (estatua || !string.Equals((Plugin.ModoOlhos.Value ?? "").Trim(), "Game", StringComparison.OrdinalIgnoreCase)) { return; } try { cartas = CartasJogo.Criar(refs, out var motivo); if (cartas == null) { Plugin.Log.LogWarning((object)("rosto em " + ((Object)this).name + ": " + motivo + "; usando as cartas proprias")); } else { cartas.Montar(); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("rosto em " + ((Object)this).name + ": cartas do jogo falharam (" + ex.Message + "); usando as cartas proprias")); try { cartas?.Desmontar(); } catch { } cartas = null; } } private static string NomeShader(Material m) { if (!((Object)(object)m != (Object)null) || !((Object)(object)m.shader != (Object)null)) { return "-"; } return ((Object)m.shader).name; } private Material Novo(Material m, string nome) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown Material val = new Material(m) { name = nome }; criados.Add(val); return val; } private static void Textura(Material m, Texture t) { //IL_0029: 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) if (!((Object)(object)t == (Object)null)) { if (m.HasProperty(MainTex)) { m.SetTexture(MainTex, t); m.SetTextureScale(MainTex, Vector2.one); m.SetTextureOffset(MainTex, Vector2.zero); } if (m.HasProperty(BaseMap)) { m.SetTexture(BaseMap, t); } } } private static void F(Material m, string p, float v) { if (m.HasProperty(p)) { m.SetFloat(p, v); } } private static Material RoupaDoJogo() { try { Customization instance = Singleton<Customization>.Instance; if ((Object)(object)instance != (Object)null && instance.fits != null && instance.fits.Length != 0 && (Object)(object)instance.fits[0] != (Object)null && (Object)(object)instance.fits[0].fitMaterial != (Object)null) { return instance.fits[0].fitMaterial; } } catch { } return null; } private void Materiais() { //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) Plugin.Tex.TryGetValue("ivory_atlas", out var value); Material[] sharedMaterials = ((Renderer)refs.mainRenderer).sharedMaterials; Material val = RoupaDoJogo() ?? ((sharedMaterials.Length > 1) ? sharedMaterials[1] : null); Material val2 = ((sharedMaterials.Length != 0) ? sharedMaterials[0] : null); Material val3 = null; Material val4 = null; Material val5 = null; mCor = null; temFantasma = false; bool flag = Plugin.ShaderJogo.Value && (Object)(object)val != (Object)null && val.HasProperty(MainTex) && (Object)(object)value != (Object)null; if (flag && estatua) { Material val6 = (((Object)(object)estatuaCorpo != (Object)null) ? estatuaCorpo.sharedMaterial : null); val3 = (((Object)(object)val6 != (Object)null) ? Novo(val6, "IV_Pedra") : Novo(val, "IV_Atlas")); if ((Object)(object)val6 == (Object)null) { Textura(val3, (Texture)(object)value); } val4 = (val5 = (mCor = val3)); } else if (flag) { val3 = Novo(val, "IV_Atlas"); Textura(val3, (Texture)(object)value); F(val3, "_UseSkinTone", 0f); F(val3, "_StatusGlow", 0f); val4 = val3; bool flag2 = (Object)(object)val2 != (Object)null && val2.HasProperty(MainTex); if (Plugin.PeleScout.Value && flag2) { val5 = Novo(val2, "IV_AtlasPele"); Textura(val5, (Texture)(object)value); F(val5, "_UseSkinTone", 0f); F(val5, "_StatusGlow", 0f); if (val5.HasProperty(Tint)) { val5.SetColor(Tint, Color.white); } } else { val5 = val3; } if (Plugin.CorJogador.Value && flag2) { mCor = Novo(val2, "IV_AtlasCor"); Textura(mCor, (Texture)(object)value); F(mCor, "_UseSkinTone", 1f); F(mCor, "_StatusGlow", 0f); } else { mCor = val3; } temFantasma = val3.HasProperty(Ghost); } mOlhos = (mBoca = null); SkinnedMeshRenderer[] componentsInChildren = raiz.GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val7 in componentsInChildren) { Material[] sharedMaterials2 = ((Renderer)val7).sharedMaterials; for (int j = 0; j < sharedMaterials2.Length; j++) { string text = (((Object)(object)sharedMaterials2[j] != (Object)null) ? ((Object)sharedMaterials2[j]).name : ""); if (text.StartsWith("IC_Olhos") || text.StartsWith("IC_Boca")) { sharedMaterials2[j] = Carta(sharedMaterials2[j], text, flag ? (val5 ?? val3) : null, val); } else if ((Object)(object)val3 != (Object)null && text.StartsWith("IC_AtlasCor")) { sharedMaterials2[j] = mCor; } else if ((Object)(object)val3 != (Object)null && text.StartsWith("IC_AtlasVidro")) { sharedMaterials2[j] = val4; } else if ((Object)(object)val3 != (Object)null && text.StartsWith("IC_AtlasPele")) { sharedMaterials2[j] = val5; } else if ((Object)(object)val3 != (Object)null && text.StartsWith("IC_Atlas")) { sharedMaterials2[j] = val3; } else if ((Object)(object)sharedMaterials2[j] != (Object)null) { sharedMaterials2[j] = Novo(sharedMaterials2[j], "IV_" + text); } if (text.StartsWith("IC_Olhos")) { mOlhos = sharedMaterials2[j]; } if (text.StartsWith("IC_Boca")) { mBoca = sharedMaterials2[j]; } } ((Renderer)val7).sharedMaterials = sharedMaterials2; } fantasmas.Clear(); espelhoStatus.Clear(); espelhoOpacidade.Clear(); tintaBase.Clear(); if (estatua) { return; } List<Material> list = ((IEnumerable<Material>)(object)new Material[4] { val3, val5, mCor, val4 }).Where((Material x) => (Object)(object)x != (Object)null).Distinct().ToList(); foreach (Material item in list) { if (item.HasProperty(Ghost)) { fantasmas.Add(item); } if (item.HasProperty(StatusGlow)) { espelhoStatus.Add(item); } } foreach (Material item2 in (from x in list.Concat((IEnumerable<Material>)(object)new Material[2] { mOlhos, mBoca }) where (Object)(object)x != (Object)null select x).Distinct()) { if (item2.HasProperty(Opacity)) { espelhoOpacidade.Add(item2); } if (item2.HasProperty(Tint) && (Object)(object)item2 != (Object)(object)mCor) { tintaBase[item2] = item2.GetColor(Tint); } } } private Material Carta(Material reserva, string nome, Material pele, Material roupa) { //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) Texture val = null; if ((Object)(object)reserva != (Object)null) { val = (reserva.HasProperty(MainTex) ? reserva.GetTexture(MainTex) : null); } if ((Object)(object)val == (Object)null && (Object)(object)reserva != (Object)null && reserva.HasProperty(BaseMap)) { val = reserva.GetTexture(BaseMap); } string text = (Plugin.ShaderRosto.Value ?? "").Trim().ToLowerInvariant(); if (text == "facecard" && Plugin.ShaderJogo.Value && !estatua) { Material val2 = (((Object)(object)refs.mouthRenderer != (Object)null) ? refs.mouthRenderer.sharedMaterial : null); if ((Object)(object)val2 != (Object)null && val2.HasProperty(MainTex)) { Material val3 = Novo(val2, "IV_" + nome); Textura(val3, val); F(val3, "_BaseScale", 1f); F(val3, "_IsEyes", 0f); val3.DisableKeyword("_ISEYES_ON"); F(val3, "_UseTalkSprites", 0f); F(val3, "_Spin", 0f); F(val3, "_Opacity", 1f); F(val3, "_Desaturate", 0f); F(val3, "_ShaderEyeTracking", 0f); if (val3.HasProperty("_Scale")) { val3.SetVector("_Scale", new Vector4(1f, 1f, 0f, 0f)); } return val3; } } else if (text != "bundle" && (Object)(object)(estatua ? roupa : pele) != (Object)null) { Material val4 = Novo(estatua ? roupa : pele, "IV_" + nome); Textura(val4, val); F(val4, "_UseTextureAlpha", 1f); F(val4, "_AlphaClip", 0.45f); F(val4, "_UseSkinTone", 0f); F(val4, "_StatusGlow", 0f); F(val4, "_VertexGhost", 0f); if (val4.HasProperty(Tint)) { val4.SetColor(Tint, Color.white); } for (int i = 1; i <= 4; i++) { string text2 = "_Texture" + i; string text3 = "_Color" + i; if (val4.HasProperty(text2) && (Object)(object)val4.GetTexture(text2) != (Object)null) { val4.SetTexture(text2, (Texture)null); if (val4.HasProperty(text3)) { val4.SetColor(text3, new Color(1f, 1f, 1f, 0f)); } } } return val4; } if (!((Object)(object)reserva != (Object)null)) { return null; } return Novo(reserva, "IV_" + nome); } private void Sombras() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_00a0: 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_00b6: 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_00cc: 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) Material val = (((Object)(object)refs.mainRendererShadow != (Object)null) ? ((Renderer)refs.mainRendererShadow).sharedMaterial : null); SkinnedMeshRenderer[] array = (SkinnedMeshRenderer[])(object)new SkinnedMeshRenderer[2] { corpo, costas }; foreach (SkinnedMeshRenderer val2 in array) { if (!((Object)(object)val2 == (Object)null)) { GameObject val3 = new GameObject(((Object)val2).name + "_Sombra") { layer = ((Component)val2).gameObject.layer }; val3.transform.SetParent(((Component)val2).transform.parent, false); val3.transform.localPosition = ((Component)val2).transform.localPosition; val3.transform.localRotation = ((Component)val2).transform.localRotation; val3.transform.localScale = ((Component)val2).transform.localScale; SkinnedMeshRenderer val4 = val3.AddComponent<SkinnedMeshRenderer>(); val4.sharedMesh = val2.sharedMesh; val4.bones = val2.bones; val4.rootBone = val2.rootBone; Material[] array2 = (Material[])(object)new Material[((Renderer)val2).sharedMaterials.Length]; for (int j = 0; j < array2.Length; j++) { array2[j] = (((Object)(object)val != (Object)null) ? val : ((Renderer)val2).sharedMaterials[j]); } ((Renderer)val4).sharedMaterials = array2; ((Renderer)val4).shadowCastingMode = (ShadowCastingMode)3; ((Renderer)val4).receiveShadows = false; val4.updateWhenOffscreen = val2.updateWhenOffscreen; if (!val2.updateWhenOffscreen) { ((Renderer)val4).localBounds = ((Renderer)val2).localBounds; } ((Renderer)val4).enabled = false; sombras.Add(val4); } } } private void ListaEscondidos() { HashSet<Renderer> fora = new HashSet<Renderer>(); if (Object.op_Implicit((Object)(object)refs.skeletonRenderer)) { fora.Add(refs.skeletonRenderer); } if (Object.op_Implicit((Object)(object)refs.chickenRenderer)) { fora.Add(refs.chickenRenderer); } if (cartas != null) { foreach (Renderer renderer in cartas.Renderers) { fora.Add(renderer); } } List<Renderer> todos = new List<Renderer>(); AddV(refs.AllRenderers); AddV(refs.PlayerRenderers); AddV(refs.EyeRenderers); AddV(refs.playerHats); Add((Renderer)(object)refs.mainRenderer); Add((Renderer)(object)refs.mainRendererShadow); Add(refs.mouthRenderer); Add(refs.accessoryRenderer); Add(refs.shorts); Add(refs.skirt); Add(refs.shortsShadow); Add(refs.skirtShadow); Add(refs.headShadow); Add(refs.sashRenderer); Add(refs.medalRenderer); if (Object.op_Implicit((Object)(object)refs.thirdEye)) { AddV(refs.thirdEye.GetComponentsInChildren<Renderer>(true)); } if (Object.op_Implicit((Object)(object)refs.hatShadowMeshFilter)) { Add(((Component)refs.hatShadowMeshFilter).GetComponent<Renderer>()); } if (Object.op_Implicit((Object)(object)refs.hatTransform)) { AddV(((Component)refs.hatTransform).GetComponentsInChildren<Renderer>(true)); } pedraJogo.Clear(); if (refs.stoneRenderers != null) { Renderer[] stoneRenderers = refs.stoneRenderers; foreach (Renderer val in stoneRenderers) { if (Object.op_Implicit((Object)(object)val)) { Add(val); pedraJogo.Add(val); } } } if (estatua) { SkinnedMeshRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val2 in componentsInChildren) { if (((Object)val2).name.StartsWith("Statue")) { Add((Renderer)(object)val2); } } } HideTheBody val3 = (((Object)(object)ch != (Object)null) ? ch.refs.hideTheBody : null); if ((Object)(object)val3 != (Object)null) { if (Object.op_Implicit((Object)(object)val3.headRend)) { Add(val3.headRend); } if (Object.op_Implicit((Object)(object)val3.shadowCaster)) { AddV(val3.shadowCaster.GetComponentsInChildren<Renderer>(true)); } if (Object.op_Implicit((Object)(object)val3.shadowCasterHat)) { AddV(val3.shadowCasterHat.GetComponentsInChildren<Renderer>(true)); } if (Object.op_Implicit((Object)(object)val3.face)) { AddV(((Component)val3.face).GetComponentsInChildren<Renderer>(true)); } } escondidos.AddRange(todos); void Add(Renderer r) { if ((Object)(object)r != (Object)null && !fora.Contains(r) && !todos.Contains(r)) { todos.Add(r); } } void AddV(IEnumerable<Renderer> rs) { if (rs != null) { foreach (Renderer r in rs) { Add(r); } } } } private void OnEnable() { if (!Laco.Ativos.Contains(this)) { Laco.Ativos.Add(this); } } private void OnDisable() { Laco.Ativos.Remove(this); } private void LateUpdate() { if (!pronto) { if (Time.time >= tentarEm && ((Behaviour)this).enabled) { Tentar(); } } else if (!Laco.Rodando) { Quadro(); } } internal void Quadro() { if (!pronto || !((Behaviour)this).isActiveAndEnabled || ((Object)(object)ch == (Object)null && (Object)(object)boneco == (Object)null) || (Object)(object)raiz == (Object)null) { return; } try { Copiar(); if (balanco != null && Plugin.Fisica.Value) { balanco.Passo(Time.deltaTime); } Visual(); foreach (Renderer escondido in escondidos) { if ((Object)(object)escondido != (Object)null && !escondido.forceRenderingOff) { escondido.forceRenderingOff = true; } } } catch (Exception ex) { int instanceID = ((Object)((Component)this).gameObject).GetInstanceID(); Falhas.TryGetValue(instanceID, out var value); Falhas[instanceID] = value + 1; Plugin.Log.LogError((object)($"IvoryAvatar.Quadro ({value + 1}a falha em {((Object)this).name}): " + ex)); pronto = false; ((Behaviour)this).enabled = false; Object.Destroy((Object)(object)this); } } private void Copiar() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < parIvory.Length; i++) { Transform val = parScout[i]; if (!((Object)(object)val == (Object)null)) { parIvory[i].SetPositionAndRotation(val.position, val.rotation); } } } private void Visual() { //IL_01ef: 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_01f6: 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_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Invalid comparison between Unknown and I4 //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Invalid comparison between Unknown and I4 //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Invalid comparison between Unknown and I4 CharacterData val = (((Object)(object)ch != (Object)null) ? ch.data : null); bool flag = ((!estatua) ? (((Renderer)refs.mainRenderer).enabled && ((Component)refs.mainRenderer).gameObject.activeInHierarchy && (!((Object)(object)refs.skeletonRenderer != (Object)null) || !((Component)refs.skeletonRenderer).gameObject.activeInHierarchy)) : ((Object)(object)estatuaCorpo != (Object)null && ((Component)estatuaCorpo).gameObject.activeInHierarchy)); bool flag2 = true; if ((Object)(object)ch != (Object)null && (Object)(object)val != (Object)null) { HideTheBody hideTheBody = ch.refs.hideTheBody; flag2 = !ch.IsLocal || val.fullyPassedOut || val.dead || ((Object)(object)hideTheBody != (Object)null && hideTheBody.isDummy); if (!ch.IsLocal && (Object)(object)val.carrier != (Object)null && val.carrier.IsLocal) { flag2 = false; } } if ((Object)(object)ch != (Object)null && Time.time >= mochilaEm) { mochilaEm = Time.time + 0.25f; mochila = false; try { Player player = ch.player; if ((Object)(object)player != (Object)null && player.backpackSlot != null) { BackpackType backpackType = player.backpackSlot.backpackType; mochila = (int)backpackType == 1 || (int)backpackType == 3 || (int)backpackType == 4; } } catch { } } if (!estatua && (Object)(object)mCor != (Object)null && Plugin.CorJogador.Value && Time.time >= corEm) { corEm = Time.time + 1f; try { Color val2 = CorDoJogador(); if (val2 != corAtual) { corAtual = val2; if (mCor.HasProperty(SkinColor)) { mCor.SetColor(SkinColor, val2); } } } catch { } } if (!estatua) { Espelhar(); } float num = (flag2 ? 0f : 1f); foreach (Material fantasma in fantasmas) { fantasma.SetFloat(Ghost, num); } ((Renderer)corpo).enabled = flag && (flag2 || temFantasma); if (Object.op_Implicit((Object)(object)costas)) { ((Renderer)costas).enabled = flag && (flag2 || temFantasma) && (!mochila || !Plugin.EsconderAljava.Value); } rostoPerto = !flag2; if (Object.op_Implicit((Object)(object)olhos)) { ((Renderer)olhos).enabled = flag && cartas == null; } if (Object.op_Implicit((Object)(object)boca)) { ((Renderer)boca).enabled = flag && (cartas == null || !cartas.TemBoca); } foreach (SkinnedMeshRenderer sombra in sombras) { ((Renderer)sombra).enabled = flag && !flag2 && (((Object)sombra).name != "Ivory_Costas_Sombra" || !mochila || !Plugin.EsconderAljava.Value); } if (flag) { Rosto(val); } } private void Espelhar() { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_00eb: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) Material val = null; if (refs.PlayerRenderers != null) { Renderer[] playerRenderers = refs.PlayerRenderers; foreach (Renderer val2 in playerRenderers) { if ((Object)(object)val2 != (Object)null && (Object)(object)val2.sharedMaterial != (Object)null && val2.sharedMaterial.HasProperty(StatusGlow)) { val = val2.sharedMaterial; break; } } } if ((Object)(object)val == (Object)null) { val = ((Renderer)refs.mainRenderer).sharedMaterial; } if ((Object)(object)val != (Object)null && espelhoStatus.Count > 0 && val.HasProperty(StatusGlow)) { float num = val.GetFloat(StatusGlow); Color val3 = (val.HasProperty(StatusColor) ? val.GetColor(StatusColor) : Color.white); if (num != glowAtual || val3 != statusAtual) { glowAtual = num; statusAtual = val3; foreach (Material item in espelhoStatus) { item.SetFloat(StatusGlow, num); if (item.HasProperty(StatusColor)) { item.SetColor(StatusColor, val3); } } } } Material sharedMaterial = ((Renderer)refs.mainRenderer).sharedMaterial; float num2 = (((Object)(object)sharedMaterial != (Object)null && sharedMaterial.HasProperty(Opacity)) ? sharedMaterial.GetFloat(Opacity) : 1f); if (num2 != opAtual) { opAtual = num2; foreach (Material item2 in espelhoOpacidade) { item2.SetFloat(Opacity, num2); } } float num3 = 0f; foreach (Renderer item3 in pedraJogo) { if (!((Object)(object)item3 == (Object)null) && ((Component)item3).gameObject.activeInHierarchy) { Material sharedMaterial2 = item3.sharedMaterial; num3 = Mathf.Max(num3, ((Object)(object)sharedMaterial2 != (Object)null && sharedMaterial2.HasProperty(Petrify)) ? Mathf.Clamp01(sharedMaterial2.GetFloat(Petrify)) : 1f); } } if (num3 == pedraAtual) { return; } pedraAtual = num3; foreach (KeyValuePair<Material, Color> item4 in tintaBase) { item4.Key.SetColor(Tint, Color.Lerp(item4.Value, CorPedra, num3)); } } private Color CorDoJogador() { //IL_0045: 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) if ((Object)(object)ch != (Object)null) { return ch.refs.customization.PlayerColor; } PersistentPlayerData playerData = GameHandler.GetService<PersistentPlayerDataService>().GetPlayerData(PhotonNetwork.LocalPlayer); return Singleton<Customization>.Instance.skins[CharacterCustomization.GetSkinIndex(playerData)].color; } internal void AntesDaCamera(Camera cam) { //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_004e: 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_0070: 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_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_009a: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) if (pronto && !((Object)(object)raiz == (Object)null)) { bool forceRenderingOff = false; if (rostoPerto && (Object)(object)cam != (Object)null) { Vector3 val = (((Object)(object)cabecaScout != (Object)null) ? cabecaScout.TransformPoint(Vector3.up) : ((!((Object)(object)cabecaIvory != (Object)null)) ? (((Object)(object)olhos != (Object)null) ? ((Component)olhos).transform.position : raiz.transform.position) : (cabecaIvory.position + cabecaIvory.up * (0.33078676f * raiz.transform.lossyScale.x)))); float num = 0.42f * raiz.transform.lossyScale.x; Vector3 val2 = ((Component)cam).transform.position - val; forceRenderingOff = ((Vector3)(ref val2)).sqrMagnitude < num * num; } if (Object.op_Implicit((Object)(object)olhos)) { ((Renderer)olhos).forceRenderingOff = forceRenderingOff; } if (Object.op_Implicit((Object)(object)boca)) { ((Renderer)boca).forceRenderingOff = forceRenderingOff; } } } private void Rosto(CharacterData d) { if (estatua) { Proprias(Plugin.Tex.ContainsKey("olhos_neutro_pedra") ? "olhos_neutro_pedra" : "olhos_neutro", Plugin.Tex.ContainsKey("boca_neutra_pedra") ? "boca_neutra_pedra" : "boca_neutra"); return; } string text = "neutro"; string text2 = "neutra"; bool flag = false; if (Plugin.Rosto.Value) { if ((Object)(object)d != (Object)null && d.dead) { text = "morta"; } else if ((Object)(object)d != (Object)null && (d.passedOut || d.fullyPassedOut)) { text = "tonta"; text2 = "o"; } else { bool flag2 = false; CharacterAnimations val = (((Object)(object)ch != (Object)null) ? ch.refs.animations : null); if ((Object)(object)val != (Object)null && CampoEmote != null) { try { flag2 = (bool)CampoEmote.GetValue(val); } catch { } } if ((Object)(object)d != (Object)null && d.fallSeconds > 0.6f) { text = "surpresa"; text2 = "o"; } else if (flag2) { text = "feliz"; text2 = "sorriso"; } else if ((Object)(object)d != (Object)null && (Object)(object)ch != (Object)null && (d.isClimbing || d.isRopeClimbing) && ch.GetTotalStamina() < 0.15f) { text = "mirar"; } float time = Time.time; if (Plugin.Piscar.Value && text != "feliz") { if (time >= proxPisca) { fimPisca = time + 0.12f; proxPisca = time + Random.Range(4f, 8f); } if (time < fimPisca) { text = ((fimPisca - time > 0.09f || fimPisca - time < 0.03f) ? "meio" : "fechado"); } } AnimatedMouth val2 = (((Object)(object)ch != (Object)null) ? ch.refs.animatedMouth : null); if ((Object)(object)val2 != (Object)null && val2.isSpeaking) { flag = true; int num = ((val2.mouthTextures != null) ? val2.mouthTextures.Length : 3); text2 = ((val2.amplitudeIndex >= Mathf.Max(2, num - 1)) ? "o" : "falando"); } } } if (cartas != null) { string text3 = ((text == "morta" || text == "tonta") ? "neutro" : text); string text4 = (flag ? "neutra" : text2); Plugin.Mascaras.TryGetValue("olho_" + text3, out var value); Plugin.Mascaras.TryGetValue("boca_" + text4, out var value2); cartas.Aplicar((Texture)(object)value, (Texture)(object)value2); if (!cartas.TemBoca) { Proprias(null, "boca_" + text2); } } else { Proprias("olhos_" + text, "boca_" + text2); } } private void Proprias(string olho, string bo) { if (olho != null && olho != olhoAtual && (Object)(object)mOlhos != (Object)null && Plugin.Tex.TryGetValue(olho, out var value)) { Textura(mOlhos, (Texture)(object)value); olhoAtual = olho; } if (bo != null && bo != bocaAtual && (Object)(object)mBoca != (Object)null && Plugin.Tex.TryGetValue(bo, out var value2)) { Textura(mBoca, (Texture)(object)value2); bocaAtual = bo; } } private void OnDestroy() { Desmontar(); } private void Desmontar() { if (cartas != null) { try { cartas.Desmontar(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("rosto ao desligar: " + ex.Message)); } cartas = null; } foreach (Renderer escondido in escondidos) { if ((Object)(object)escondido != (Object)null) { escondido.forceRenderingOff = false; } } escondidos.Clear(); pedraJogo.Clear(); if ((Object)(object)raiz != (Object)null) { Object.Destroy((Object)(object)raiz); } raiz = null; foreach (Material criado in criados) { if ((Object)(object)criado != (Object)null) { Object.Destroy((Object)(object)criado); } } criados.Clear(); fantasmas.Clear(); sombras.Clear(); espelhoStatus.Clear(); espelhoOpacidade.Clear(); tintaBase.Clear(); corpo = (costas = (olhos = (boca = null))); mOlhos = (mBoca = (mCor = null)); balanco = null; pronto = false; olhoAtual = (bocaAtual = null); glowAtual = (opAtual = (pedraAtual = -1f)); } } public static class Laco { [StructLayout(LayoutKind.Sequential, Size = 1)] private struct IvoryPeakQuadro { } [CompilerGenerated] private static class <>O { public static Action<ScriptableRenderContext, Camera> <0>__AntesDaCamera; public static UpdateFunction <1>__Rodar; } public static readonly List<IvoryAvatar> Ativos = new List<IvoryAvatar>(); public static int UltimoQuadro = -100; private static bool cameraLigada; public static bool Rodando => Time.frameCount - UltimoQuadro <= 2; public static bool Presente() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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) PlayerLoopSystem currentPlayerLoop = PlayerLoop.GetCurrentPlayerLoop(); if (currentPlayerLoop.subSystemList == null) { return false; } PlayerLoopSystem[] subSystemList = currentPlayerLoop.subSystemList; foreach (PlayerLoopSystem val in subSystemList) { if (val.type == typeof(PostLateUpdate) && val.subSystemList != null && val.subSystemList.Any((PlayerLoopSystem x) => x.type == typeof(IvoryPeakQuadro))) { return true; } } return false; } private static void AntesDaCamera(ScriptableRenderContext ctx, Camera cam) { for (int i = 0; i < Ativos.Count; i++) { IvoryAvatar ivoryAvatar = Ativos[i]; if ((Object)(object)ivoryAvatar != (Object)null) { ivoryAvatar.AntesDaCamera(cam); } } } public static void Instalar() { //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_00f3: 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_0067: 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_00bb: Unknown result type (might be