Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Repomon v1.0.1
RepoDex.dll
Decompiled 2 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Omniscye.RepoDex; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a1f7578798bef3223b874192b5811a336e1f9a04")] [assembly: AssemblyProduct("RepoDex")] [assembly: AssemblyTitle("RepoDex")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Omniscye.RepoDex { [BepInPlugin("Omniscye.RepoDex", "RepoDex", "1.2.0")] public class RepoDexPlugin : BaseUnityPlugin, IOnEventCallback { private struct CaptureEntry { public int Seq; public string Kind; public string Name; public DateTime TimeUtc; } private const byte RepoDexEventCode = 187; private readonly List<CaptureEntry> _entries = new List<CaptureEntry>(); private readonly HashSet<string> _seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private string _savePath = ""; private GameObject _canvasRoot; private Canvas _canvas; private GameObject _panelRoot; private TMP_InputField _search; private TMP_Dropdown _kindDropdown; private RectTransform _contentRect; private ScrollRect _scroll; private bool _uiVisible; private bool _active; private GameObject _receiverGo; private ConfigEntry<KeyCode> _toggleKey; private ConfigEntry<Vector2> _uiPosition; private ConfigEntry<float> _uiScale; private readonly Color _bg = new Color(0.03f, 0.05f, 0.12f, 0.96f); private readonly Color _text = new Color(0.98f, 0.97f, 1f, 1f); private readonly Color _muted = new Color(0.75f, 0.8f, 0.92f, 1f); private readonly Color _accentRed = new Color(0.75f, 0.1f, 0.2f, 1f); private readonly Color _accentBlue = new Color(0.14f, 0.25f, 0.7f, 1f); private readonly Color _rowDark = new Color(0.05f, 0.08f, 0.16f, 0.95f); private readonly Color _rowLight = new Color(0.07f, 0.11f, 0.2f, 0.95f); private CursorLockMode _prevLock; private bool _prevVisible; internal static RepoDexPlugin Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } internal static bool UIActive => (Object)(object)Instance != (Object)null && Instance._uiVisible; private void Awake() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_004d: Expected O, but got Unknown Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); _toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("UI", "ToggleKey", (KeyCode)289, "Toggle RepoDex"); _uiPosition = ((BaseUnityPlugin)this).Config.Bind<Vector2>("UI", "Position", new Vector2(0f, 0f), (ConfigDescription)null); _uiScale = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "Scale", 1f, (ConfigDescription)null); string text = Path.Combine(Paths.ConfigPath, "RepoDex"); Directory.CreateDirectory(text); _savePath = Path.Combine(text, "repodex.dat"); GameObject val3 = new GameObject("__RepoDex_Runtime"); ((Object)val3).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val3); val3.AddComponent<RepoDexRuntime>(); LoadEntries(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} loaded"); } private void OnDestroy() { DeactivateRuntime(); SaveEntries(); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { //IL_0016: 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_003c: Invalid comparison between Unknown and I4 if (!_active) { return; } if (Input.GetKeyDown(_toggleKey.Value)) { ToggleUI(); } if (_uiVisible) { if ((int)Cursor.lockState > 0) { Cursor.lockState = (CursorLockMode)0; } if (!Cursor.visible) { Cursor.visible = true; } } } public void OnEvent(EventData photonEvent) { if (!_active || photonEvent.Code != 187) { return; } try { if (!(photonEvent.CustomData is object[] array) || array.Length < 2) { return; } string text = ((array[0] as string) ?? string.Empty).Trim(); string text2 = ((array[1] as string) ?? string.Empty).Trim(); long ticks = ((array.Length >= 3 && array[2] is long num) ? num : DateTime.UtcNow.Ticks); string kind = text; string text3 = text2; if (array.Length >= 5) { string text4 = (array[3] as string) ?? string.Empty; string text5 = (array[4] as string) ?? string.Empty; if (!string.IsNullOrEmpty(text4)) { kind = text4.Trim(); } if (!string.IsNullOrEmpty(text5)) { text3 = text5.Trim(); } } if (LooksLikeCapturer(text3) && TryExtractTargetFromPayload(array, 0, out string targetKind, out string targetName) && !LooksLikeCapturer(targetName)) { kind = targetKind; text3 = targetName; } if (string.IsNullOrWhiteSpace(text3)) { text3 = "Unknown"; } AddEntry(kind, text3, new DateTime(ticks, DateTimeKind.Utc)); } catch (Exception arg) { Logger.LogWarning((object)$"RepoDex OnEvent parse failed: {arg}"); } } private static bool LooksLikeCapturer(string s) { if (string.IsNullOrEmpty(s)) { return false; } string text = s.ToLowerInvariant(); return text.Contains("repoball") || text.Contains("captureball") || text.Contains("trapball"); } private bool TryExtractTargetFromPayload(object[] data, int startIndex, out string targetKind, out string targetName) { targetKind = string.Empty; targetName = string.Empty; for (int i = Math.Max(3, startIndex); i < data.Length; i++) { object obj = data[i]; if (obj == null) { continue; } if (obj is IDictionary dictionary) { if (TryExtractFromDictionary(dictionary, out targetKind, out targetName)) { return true; } if (TryFindPhotonViewInDictionary(dictionary, out PhotonView pv) && TryResolveKindAndName(pv, out targetKind, out targetName)) { return true; } foreach (DictionaryEntry item in dictionary) { if (item.Value is IDictionary dict && TryExtractFromDictionary(dict, out targetKind, out targetName)) { return true; } } } if (obj is int num && num != 0) { PhotonView val = PhotonView.Find(num); if (Object.op_Implicit((Object)(object)val) && TryResolveKindAndName(val, out targetKind, out targetName)) { return true; } } if (obj is long num2 && num2 > 0 && num2 <= int.MaxValue) { PhotonView val2 = PhotonView.Find((int)num2); if (Object.op_Implicit((Object)(object)val2) && TryResolveKindAndName(val2, out targetKind, out targetName)) { return true; } } PhotonView val3 = (PhotonView)((obj is PhotonView) ? obj : null); if (val3 != null && Object.op_Implicit((Object)(object)val3) && TryResolveKindAndName(val3, out targetKind, out targetName)) { return true; } GameObject val4 = (GameObject)((obj is GameObject) ? obj : null); if (val4 != null && Object.op_Implicit((Object)(object)val4) && TryResolveKindAndName(val4, out targetKind, out targetName)) { return true; } Component val5 = (Component)((obj is Component) ? obj : null); if (val5 != null && Object.op_Implicit((Object)(object)val5) && TryResolveKindAndName(val5.gameObject, out targetKind, out targetName)) { return true; } } return false; } private bool TryExtractFromDictionary(IDictionary dict, out string targetKind, out string targetName) { targetKind = string.Empty; targetName = string.Empty; try { string[] array = new string[6] { "targetKind", "kind", "tKind", "k", "type", "category" }; string[] array2 = new string[6] { "targetName", "name", "tName", "n", "label", "title" }; string[] array3 = array; foreach (string key in array3) { if (dict.Contains(key) && dict[key] is string text && !string.IsNullOrEmpty(text)) { targetKind = text; } } string[] array4 = array2; foreach (string key2 in array4) { if (dict.Contains(key2) && dict[key2] is string text2 && !string.IsNullOrEmpty(text2)) { targetName = text2; } } if (!string.IsNullOrEmpty(targetKind) && !string.IsNullOrEmpty(targetName)) { return true; } foreach (DictionaryEntry item in dict) { if ((item.Key is byte || item.Key is sbyte || item.Key is short || item.Key is int) && item.Value is string text3 && string.IsNullOrEmpty(targetName) && !LooksLikeCapturer(text3)) { targetName = text3; } } if (!string.IsNullOrEmpty(targetName) && string.IsNullOrEmpty(targetKind)) { if (TryFindPhotonViewInDictionary(dict, out PhotonView pv) && Object.op_Implicit((Object)(object)pv) && TryResolveKindAndName(pv, out string kind, out string name)) { targetKind = kind; if (!string.IsNullOrEmpty(name) && !LooksLikeCapturer(name)) { targetName = name; } return true; } targetKind = GuessKindFromName(targetName); return true; } } catch { } return false; } private bool TryFindPhotonViewInDictionary(IDictionary dict, out PhotonView pv) { pv = null; try { object[] array = new object[12] { "targetViewId", "viewId", "pvId", "photonViewId", "vid", "id", "targetId", (byte)0, (byte)1, (byte)2, (byte)3, (byte)4 }; object[] array2 = array; foreach (object key in array2) { if (!dict.Contains(key)) { continue; } object obj = dict[key]; if (obj is int num && num != 0) { pv = PhotonView.Find(num); if (Object.op_Implicit((Object)(object)pv)) { return true; } } if (obj is long num2 && num2 > 0 && num2 <= int.MaxValue) { pv = PhotonView.Find((int)num2); if (Object.op_Implicit((Object)(object)pv)) { return true; } } } foreach (DictionaryEntry item in dict) { if (item.Value is int num3 && num3 != 0) { PhotonView val = PhotonView.Find(num3); if (Object.op_Implicit((Object)(object)val)) { pv = val; return true; } } if (item.Value is long num4 && num4 > 0 && num4 <= int.MaxValue) { PhotonView val2 = PhotonView.Find((int)num4); if (Object.op_Implicit((Object)(object)val2)) { pv = val2; return true; } } } } catch { } return (Object)(object)pv != (Object)null; } private string GuessKindFromName(string n) { if (string.IsNullOrEmpty(n)) { return "Object"; } string text = n.ToLowerInvariant(); if (text.Contains("player") || text.Contains("(you)")) { return "Player"; } if (text.Contains("duck") || text.Contains("predator") || text.Contains("enemy")) { return "Enemy"; } if (text.Contains("potion") || text.Contains("gun") || text.Contains("key") || text.Contains("item")) { return "Item"; } if (text.Contains("valuable") || text.Contains("$") || text.Contains("gold")) { return "Valuable"; } return "Object"; } private bool TryResolveKindAndName(GameObject go, out string kind, out string name) { kind = string.Empty; name = string.Empty; if (!Object.op_Implicit((Object)(object)go)) { return false; } PlayerAvatar componentInParent = go.GetComponentInParent<PlayerAvatar>(); if (Object.op_Implicit((Object)(object)componentInParent)) { kind = "Player"; try { name = SemiFunc.PlayerGetName(componentInParent); } catch { name = ((Object)go).name; } return true; } EnemyParent componentInParent2 = go.GetComponentInParent<EnemyParent>(); if (Object.op_Implicit((Object)(object)componentInParent2)) { kind = "Enemy"; try { name = componentInParent2.enemyName; } catch { name = ((Object)go).name; } if (string.IsNullOrWhiteSpace(name)) { name = ((Object)go).name; } return true; } ItemAttributes componentInParent3 = go.GetComponentInParent<ItemAttributes>(); if (Object.op_Implicit((Object)(object)componentInParent3)) { kind = "Item"; try { if ((Object)(object)componentInParent3.item != (Object)null && !string.IsNullOrEmpty(componentInParent3.item.itemName)) { name = componentInParent3.item.itemName; } else if (!string.IsNullOrEmpty(componentInParent3.itemName)) { name = componentInParent3.itemName; } else { name = ((Object)go).name; } } catch { name = ((Object)go).name; } return true; } ValuableObject componentInParent4 = go.GetComponentInParent<ValuableObject>(); if (Object.op_Implicit((Object)(object)componentInParent4)) { kind = "Valuable"; name = ((Object)go).name; return true; } kind = "Object"; name = ((Object)go).name; return true; } private bool TryResolveKindAndName(PhotonView pv, out string kind, out string name) { if (Object.op_Implicit((Object)(object)pv) && TryResolveKindAndName(((Component)pv).gameObject, out kind, out name)) { return true; } kind = string.Empty; name = string.Empty; return false; } internal void ActivateRuntime() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown if (!_active) { PhotonNetwork.AddCallbackTarget((object)this); BuildCanvas(); BuildPanel(); _receiverGo = new GameObject("RepoDexReceiver_EMPRESS"); ((Object)_receiverGo).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)_receiverGo); _receiverGo.AddComponent<RepoDexReceiver>(); _active = true; RefreshList(); } } internal void DeactivateRuntime() { if (_active) { PhotonNetwork.RemoveCallbackTarget((object)this); if (_uiVisible) { RestoreCursor(); } if (Object.op_Implicit((Object)(object)_panelRoot)) { Object.Destroy((Object)(object)_panelRoot); } if (Object.op_Implicit((Object)(object)_canvasRoot)) { Object.Destroy((Object)(object)_canvasRoot); } if (Object.op_Implicit((Object)(object)_receiverGo)) { Object.Destroy((Object)(object)_receiverGo); } _panelRoot = null; _canvasRoot = null; _canvas = null; _receiverGo = null; _uiVisible = false; _active = false; } } internal void AddEntry(string kind, string name, DateTime utc) { switch (kind) { case "Enemies": kind = "Enemy"; break; case "Players": kind = "Player"; break; case "Valuables": kind = "Valuable"; break; } kind = (string.IsNullOrWhiteSpace(kind) ? "Object" : kind.Trim()); name = (string.IsNullOrWhiteSpace(name) ? "Unknown" : name.Trim()); string item = kind + "|" + name; if (!_seen.Contains(item)) { CaptureEntry captureEntry = default(CaptureEntry); captureEntry.Seq = _entries.Count + 1; captureEntry.Kind = kind; captureEntry.Name = name; captureEntry.TimeUtc = utc; CaptureEntry item2 = captureEntry; _entries.Add(item2); _seen.Add(item); SaveEntries(); RefreshList(); } } private void ToggleUI() { _uiVisible = !_uiVisible; if (Object.op_Implicit((Object)(object)_panelRoot)) { _panelRoot.SetActive(_uiVisible); } if (_uiVisible) { TakeCursor(); RefreshList(); } else { RestoreCursor(); } } private void BuildCanvas() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_008e: 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_00cc: Expected O, but got Unknown _canvasRoot = new GameObject("RepoDexCanvas_EMPRESS"); Object.DontDestroyOnLoad((Object)(object)_canvasRoot); _canvasRoot.layer = LayerMask.NameToLayer("UI"); _canvas = _canvasRoot.AddComponent<Canvas>(); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = 32766; _canvas.overrideSorting = true; CanvasScaler val = _canvasRoot.AddComponent<CanvasScaler>(); val.uiScaleMode = (ScaleMode)1; val.referenceResolution = new Vector2(1920f, 1080f); val.matchWidthOrHeight = 1f; _canvasRoot.AddComponent<GraphicRaycaster>(); if ((Object)(object)EventSystem.current == (Object)null) { GameObject val2 = new GameObject("EventSystem"); val2.AddComponent<EventSystem>(); val2.AddComponent<StandaloneInputModule>(); Object.DontDestroyOnLoad((Object)(object)val2); } } private void BuildPanel() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: 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_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Expected O, but got Unknown //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Expected O, but got Unknown //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_0648: Unknown result type (might be due to invalid IL or missing references) //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_06ce: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_070a: Expected O, but got Unknown //IL_084f: Unknown result type (might be due to invalid IL or missing references) //IL_0866: Unknown result type (might be due to invalid IL or missing references) //IL_087d: Unknown result type (might be due to invalid IL or missing references) //IL_0894: Unknown result type (might be due to invalid IL or missing references) //IL_08ab: Unknown result type (might be due to invalid IL or missing references) //IL_090e: Unknown result type (might be due to invalid IL or missing references) //IL_094a: Unknown result type (might be due to invalid IL or missing references) //IL_0965: Unknown result type (might be due to invalid IL or missing references) //IL_0980: Unknown result type (might be due to invalid IL or missing references) //IL_099b: Unknown result type (might be due to invalid IL or missing references) //IL_09b6: Unknown result type (might be due to invalid IL or missing references) //IL_0a0a: Unknown result type (might be due to invalid IL or missing references) //IL_0a14: Expected O, but got Unknown _panelRoot = CreateUIElement("Panel", _canvasRoot.transform); RectTransform component = _panelRoot.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.sizeDelta = new Vector2(900f, 640f); component.anchoredPosition = _uiPosition.Value; ((Transform)component).localScale = new Vector3(_uiScale.Value, _uiScale.Value, 1f); Image val = _panelRoot.AddComponent<Image>(); ((Graphic)val).color = _bg; Outline val2 = _panelRoot.AddComponent<Outline>(); ((Shadow)val2).effectColor = new Color(0f, 0f, 0f, 0.9f); ((Shadow)val2).effectDistance = new Vector2(3f, -3f); GameObject val3 = CreateUIElement("TopBar", _panelRoot.transform); RectTransform component2 = val3.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 1f); component2.anchorMax = new Vector2(1f, 1f); component2.pivot = new Vector2(0.5f, 1f); component2.sizeDelta = new Vector2(-20f, 56f); component2.anchoredPosition = new Vector2(0f, -10f); Image val4 = val3.AddComponent<Image>(); ((Graphic)val4).color = _accentRed; HorizontalLayoutGroup val5 = val3.AddComponent<HorizontalLayoutGroup>(); ((LayoutGroup)val5).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)val5).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)val5).childControlWidth = false; ((HorizontalOrVerticalLayoutGroup)val5).spacing = 10f; ((LayoutGroup)val5).padding = new RectOffset(14, 14, 6, 6); GameObject val6 = CreateUIElement("BadgeLeft", val3.transform); Image val7 = val6.AddComponent<Image>(); ((Graphic)val7).color = _accentBlue; LayoutElement val8 = val6.AddComponent<LayoutElement>(); val8.minWidth = 20f; val8.minHeight = 20f; GameObject val9 = CreateUIElement("TitleContainer", val3.transform); LayoutElement val10 = val9.AddComponent<LayoutElement>(); val10.minWidth = 260f; VerticalLayoutGroup val11 = val9.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)val11).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)val11).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val11).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val11).spacing = -4f; TMP_Text val12 = CreateText("REPODEX", 30, val9.transform, (FontStyles)1); ((Graphic)val12).color = _text; val12.enableWordWrapping = false; TMP_Text val13 = CreateText("Capture Index", 16, val9.transform, (FontStyles)2); ((Graphic)val13).color = _muted; val13.enableWordWrapping = false; GameObject val14 = CreateUIElement("TopSpacer", val3.transform); LayoutElement val15 = val14.AddComponent<LayoutElement>(); val15.flexibleWidth = 1f; TMP_Text val16 = CreateText("Entries: 0", 18, val3.transform, (FontStyles)1); ((Graphic)val16).color = _text; val16.alignment = (TextAlignmentOptions)516; val16.enableWordWrapping = false; LayoutElement val17 = ((Component)val16).gameObject.AddComponent<LayoutElement>(); val17.minWidth = 140f; Button val18 = CreateButton("X", 22, val3.transform); LayoutElement component3 = ((Component)val18).GetComponent<LayoutElement>(); component3.minWidth = 42f; component3.minHeight = 32f; ((UnityEvent)val18.onClick).AddListener((UnityAction)delegate { ToggleUI(); }); GameObject val19 = CreateUIElement("StatsBar", _panelRoot.transform); RectTransform component4 = val19.GetComponent<RectTransform>(); component4.anchorMin = new Vector2(0f, 1f); component4.anchorMax = new Vector2(1f, 1f); component4.pivot = new Vector2(0.5f, 1f); component4.sizeDelta = new Vector2(-20f, 42f); component4.anchoredPosition = new Vector2(0f, -72f); Image val20 = val19.AddComponent<Image>(); ((Graphic)val20).color = new Color(0.04f, 0.07f, 0.18f, 0.95f); HorizontalLayoutGroup val21 = val19.AddComponent<HorizontalLayoutGroup>(); ((LayoutGroup)val21).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)val21).spacing = 10f; ((LayoutGroup)val21).padding = new RectOffset(14, 14, 4, 4); ((HorizontalOrVerticalLayoutGroup)val21).childControlWidth = false; ((HorizontalOrVerticalLayoutGroup)val21).childForceExpandWidth = false; TMP_Text val22 = CreateText("No.", 16, val19.transform, (FontStyles)1); ((Graphic)val22).color = _muted; val22.enableWordWrapping = false; LayoutElement val23 = ((Component)val22).gameObject.AddComponent<LayoutElement>(); val23.minWidth = 60f; TMP_Text val24 = CreateText("Name", 16, val19.transform, (FontStyles)1); ((Graphic)val24).color = _muted; val24.enableWordWrapping = false; LayoutElement val25 = ((Component)val24).gameObject.AddComponent<LayoutElement>(); val25.minWidth = 230f; val25.flexibleWidth = 1f; TMP_Text val26 = CreateText("Kind", 16, val19.transform, (FontStyles)1); ((Graphic)val26).color = _muted; val26.enableWordWrapping = false; LayoutElement val27 = ((Component)val26).gameObject.AddComponent<LayoutElement>(); val27.minWidth = 120f; TMP_Text val28 = CreateText("Captured", 16, val19.transform, (FontStyles)1); ((Graphic)val28).color = _muted; val28.enableWordWrapping = false; LayoutElement val29 = ((Component)val28).gameObject.AddComponent<LayoutElement>(); val29.minWidth = 170f; GameObject val30 = CreateUIElement("Tools", _panelRoot.transform); RectTransform component5 = val30.GetComponent<RectTransform>(); component5.anchorMin = new Vector2(0f, 1f); component5.anchorMax = new Vector2(1f, 1f); component5.pivot = new Vector2(0.5f, 1f); component5.sizeDelta = new Vector2(-20f, 48f); component5.anchoredPosition = new Vector2(0f, -122f); Image val31 = val30.AddComponent<Image>(); ((Graphic)val31).color = new Color(0.02f, 0.03f, 0.1f, 0.85f); HorizontalLayoutGroup val32 = val30.AddComponent<HorizontalLayoutGroup>(); ((LayoutGroup)val32).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)val32).spacing = 8f; ((LayoutGroup)val32).padding = new RectOffset(14, 14, 6, 6); ((HorizontalOrVerticalLayoutGroup)val32).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val32).childForceExpandWidth = true; _search = CreateInput("Search name or kind", val30.transform); LayoutElement component6 = ((Component)_search).gameObject.GetComponent<LayoutElement>(); component6.minWidth = 380f; component6.preferredWidth = 500f; component6.flexibleWidth = 1f; ((UnityEvent<string>)(object)_search.onValueChanged).AddListener((UnityAction<string>)delegate { RefreshList(); }); _kindDropdown = CreateDropdown(new string[5] { "All", "Enemy", "Player", "Valuable", "Item" }, val30.transform); LayoutElement component7 = ((Component)_kindDropdown).gameObject.GetComponent<LayoutElement>(); component7.minWidth = 190f; component7.preferredWidth = 210f; component7.flexibleWidth = 0f; ((UnityEvent<int>)(object)_kindDropdown.onValueChanged).AddListener((UnityAction<int>)delegate { RefreshList(); }); GameObject val33 = CreateUIElement("Body", _panelRoot.transform); RectTransform component8 = val33.GetComponent<RectTransform>(); component8.anchorMin = new Vector2(0f, 0f); component8.anchorMax = new Vector2(1f, 1f); component8.pivot = new Vector2(0.5f, 0.5f); component8.offsetMin = new Vector2(10f, 10f); component8.offsetMax = new Vector2(-10f, -176f); _scroll = val33.AddComponent<ScrollRect>(); _scroll.horizontal = false; _scroll.movementType = (MovementType)2; Mask val34 = val33.AddComponent<Mask>(); val34.showMaskGraphic = false; Image val35 = val33.AddComponent<Image>(); ((Graphic)val35).color = new Color(0f, 0f, 0f, 0.25f); GameObject val36 = CreateUIElement("Content", val33.transform); _contentRect = val36.GetComponent<RectTransform>(); _contentRect.anchorMin = new Vector2(0f, 1f); _contentRect.anchorMax = new Vector2(1f, 1f); _contentRect.pivot = new Vector2(0.5f, 1f); _contentRect.offsetMin = new Vector2(4f, 0f); _contentRect.offsetMax = new Vector2(-4f, 0f); VerticalLayoutGroup val37 = val36.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)val37).childAlignment = (TextAnchor)0; ((HorizontalOrVerticalLayoutGroup)val37).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)val37).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val37).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val37).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val37).spacing = 4f; ((LayoutGroup)val37).padding = new RectOffset(4, 4, 6, 6); ContentSizeFitter val38 = val36.AddComponent<ContentSizeFitter>(); val38.verticalFit = (FitMode)2; _scroll.content = _contentRect; _scroll.viewport = component8; TMP_Text countBinding = val16; RepoDexRuntime.OnEntriesChanged = delegate { if (Object.op_Implicit((Object)(object)countBinding)) { countBinding.text = "Entries: " + _entries.Count; } }; _panelRoot.SetActive(false); } private void RefreshList() { //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Expected O, but got Unknown //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_panelRoot) || !Object.op_Implicit((Object)(object)_contentRect)) { return; } for (int num = ((Transform)_contentRect).childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)((Transform)_contentRect).GetChild(num)).gameObject); } string q = (Object.op_Implicit((Object)(object)_search) ? _search.text : ""); int num2 = (Object.op_Implicit((Object)(object)_kindDropdown) ? _kindDropdown.value : 0); IEnumerable<CaptureEntry> enumerable = _entries.OrderByDescending((CaptureEntry e) => e.Seq); if (!string.IsNullOrEmpty(q)) { enumerable = enumerable.Where((CaptureEntry e) => e.Name.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0 || e.Kind.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0); } switch (num2) { case 1: enumerable = enumerable.Where((CaptureEntry e) => e.Kind == "Enemy"); break; case 2: enumerable = enumerable.Where((CaptureEntry e) => e.Kind == "Player"); break; case 3: enumerable = enumerable.Where((CaptureEntry e) => e.Kind == "Valuable"); break; case 4: enumerable = enumerable.Where((CaptureEntry e) => e.Kind == "Item"); break; } int num3 = 0; foreach (CaptureEntry item in enumerable) { bool flag = num3 % 2 == 0; num3++; GameObject val = CreateUIElement("Row", (Transform)(object)_contentRect); RectTransform component = val.GetComponent<RectTransform>(); component.sizeDelta = new Vector2(0f, 44f); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = (flag ? _rowDark : _rowLight); Outline val3 = val.AddComponent<Outline>(); ((Shadow)val3).effectColor = new Color(0f, 0f, 0f, 0.75f); ((Shadow)val3).effectDistance = new Vector2(1f, -1f); HorizontalLayoutGroup val4 = val.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val4).childForceExpandWidth = false; ((LayoutGroup)val4).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)val4).spacing = 8f; ((LayoutGroup)val4).padding = new RectOffset(10, 10, 4, 4); TMP_Text val5 = CreateText(item.Seq.ToString("D3"), 18, val.transform, (FontStyles)1); ((Graphic)val5).color = _accentBlue; val5.alignment = (TextAlignmentOptions)4097; val5.enableWordWrapping = false; val5.overflowMode = (TextOverflowModes)1; LayoutElement val6 = ((Component)val5).gameObject.AddComponent<LayoutElement>(); val6.minWidth = 60f; val6.flexibleWidth = 0f; TMP_Text val7 = CreateText(item.Name, 20, val.transform, (FontStyles)1); ((Graphic)val7).color = _text; val7.alignment = (TextAlignmentOptions)4097; val7.enableWordWrapping = false; val7.overflowMode = (TextOverflowModes)1; LayoutElement val8 = ((Component)val7).gameObject.AddComponent<LayoutElement>(); val8.minWidth = 230f; val8.flexibleWidth = 1f; TMP_Text val9 = CreateTag(item.Kind, val.transform); val9.enableWordWrapping = false; val9.overflowMode = (TextOverflowModes)1; LayoutElement component2 = ((Component)val9.transform.parent).GetComponent<LayoutElement>(); if ((Object)(object)component2 != (Object)null) { component2.minWidth = 120f; component2.preferredWidth = 120f; component2.flexibleWidth = 0f; } TMP_Text val10 = CreateText(item.TimeUtc.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"), 16, val.transform, (FontStyles)0); ((Graphic)val10).color = _muted; val10.alignment = (TextAlignmentOptions)4097; val10.enableWordWrapping = false; val10.overflowMode = (TextOverflowModes)1; LayoutElement val11 = ((Component)val10).gameObject.AddComponent<LayoutElement>(); val11.minWidth = 170f; val11.flexibleWidth = 0f; } LayoutRebuilder.ForceRebuildLayoutImmediate(_contentRect); if (RepoDexRuntime.OnEntriesChanged != null) { RepoDexRuntime.OnEntriesChanged(); } } private GameObject CreateUIElement(string name, Transform parent) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.AddComponent<RectTransform>(); return val; } private TMP_Text CreateText(string s, int size, Transform parent, FontStyles style) { //IL_0027: 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) GameObject val = CreateUIElement("Text", parent); TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val2).text = s; ((TMP_Text)val2).fontSize = size; ((TMP_Text)val2).fontStyle = style; ((Graphic)val2).color = _text; return (TMP_Text)(object)val2; } private Button CreateButton(string s, int size, Transform parent) { //IL_002a: 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_009a: 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_00b4: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIElement("Button", parent); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = new Color(0.2f, 0.1f, 0.3f, 0.8f); Button result = val.AddComponent<Button>(); LayoutElement val3 = val.AddComponent<LayoutElement>(); val3.minWidth = 40f; val3.minHeight = 34f; TMP_Text val4 = CreateText(s, size, val.transform, (FontStyles)1); val4.alignment = (TextAlignmentOptions)514; val4.enableWordWrapping = false; RectTransform rectTransform = val4.rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; return result; } private TMP_InputField CreateInput(string placeholder, Transform parent) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIElement("Input", parent); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = new Color(0f, 0f, 0f, 0.4f); LayoutElement val3 = val.AddComponent<LayoutElement>(); val3.minWidth = 300f; val3.minHeight = 34f; TMP_InputField val4 = val.AddComponent<TMP_InputField>(); GameObject val5 = CreateUIElement("Text", val.transform); TextMeshProUGUI val6 = val5.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val6).fontSize = 20f; ((Graphic)val6).color = _text; ((Graphic)val6).raycastTarget = true; ((TMP_Text)val6).enableWordWrapping = false; ((TMP_Text)val6).overflowMode = (TextOverflowModes)1; GameObject val7 = CreateUIElement("Placeholder", val.transform); TextMeshProUGUI val8 = val7.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val8).text = placeholder; ((TMP_Text)val8).fontSize = 20f; ((Graphic)val8).color = _muted; ((Graphic)val8).raycastTarget = true; ((TMP_Text)val8).enableWordWrapping = false; ((TMP_Text)val8).overflowMode = (TextOverflowModes)1; val4.textComponent = (TMP_Text)(object)val6; val4.placeholder = (Graphic)(object)val8; RectTransform rectTransform = ((TMP_Text)val6).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = new Vector2(8f, 4f); rectTransform.offsetMax = new Vector2(-8f, -4f); RectTransform rectTransform2 = ((TMP_Text)val8).rectTransform; rectTransform2.anchorMin = Vector2.zero; rectTransform2.anchorMax = Vector2.one; rectTransform2.offsetMin = new Vector2(8f, 4f); rectTransform2.offsetMax = new Vector2(-8f, -4f); return val4; } private TMP_Dropdown CreateDropdown(IEnumerable<string> options, Transform parent) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Expected O, but got Unknown //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIElement("Dropdown", parent); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = new Color(0f, 0f, 0f, 0.4f); LayoutElement val3 = val.AddComponent<LayoutElement>(); val3.minWidth = 180f; val3.minHeight = 34f; TMP_Dropdown val4 = val.AddComponent<TMP_Dropdown>(); GameObject val5 = CreateUIElement("Label", val.transform); TextMeshProUGUI val6 = val5.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val6).fontSize = 20f; ((Graphic)val6).color = _text; ((TMP_Text)val6).alignment = (TextAlignmentOptions)4097; ((TMP_Text)val6).enableWordWrapping = false; ((TMP_Text)val6).overflowMode = (TextOverflowModes)1; GameObject val7 = CreateUIElement("Template", val.transform); RectTransform component = val7.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0f); component.anchorMax = new Vector2(1f, 0f); component.pivot = new Vector2(0.5f, 1f); component.sizeDelta = new Vector2(0f, 150f); Image val8 = val7.AddComponent<Image>(); ((Graphic)val8).color = new Color(0f, 0f, 0f, 0.6f); ScrollRect val9 = val7.AddComponent<ScrollRect>(); val9.horizontal = false; GameObject val10 = CreateUIElement("Viewport", val7.transform); RectTransform component2 = val10.GetComponent<RectTransform>(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.sizeDelta = Vector2.zero; val10.AddComponent<RectMask2D>(); Image val11 = val10.AddComponent<Image>(); ((Graphic)val11).color = new Color(0f, 0f, 0f, 0.2f); GameObject val12 = CreateUIElement("Content", val10.transform); RectTransform component3 = val12.GetComponent<RectTransform>(); component3.anchorMin = new Vector2(0f, 1f); component3.anchorMax = new Vector2(1f, 1f); component3.pivot = new Vector2(0.5f, 1f); VerticalLayoutGroup val13 = val12.AddComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val13).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val13).childControlHeight = true; ((LayoutGroup)val13).padding = new RectOffset(4, 4, 4, 4); ((HorizontalOrVerticalLayoutGroup)val13).spacing = 2f; val12.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2; val9.content = component3; val9.viewport = component2; GameObject val14 = CreateUIElement("Item", val12.transform); Toggle val15 = val14.AddComponent<Toggle>(); LayoutElement val16 = val14.AddComponent<LayoutElement>(); val16.minHeight = 24f; GameObject val17 = CreateUIElement("Item Background", val14.transform); Image val18 = val17.AddComponent<Image>(); ((Graphic)val18).color = new Color(0.1f, 0.12f, 0.2f, 0.8f); ((Selectable)val15).targetGraphic = (Graphic)(object)val18; GameObject val19 = CreateUIElement("Item Checkmark", val17.transform); Image val20 = val19.AddComponent<Image>(); ((Graphic)val20).color = _accentBlue; val15.graphic = (Graphic)(object)val20; GameObject val21 = CreateUIElement("Item Label", val14.transform); TextMeshProUGUI val22 = val21.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val22).fontSize = 18f; ((Graphic)val22).color = _text; ((TMP_Text)val22).alignment = (TextAlignmentOptions)513; ((TMP_Text)val22).enableWordWrapping = false; ((TMP_Text)val22).overflowMode = (TextOverflowModes)1; val4.captionText = (TMP_Text)(object)val6; val4.template = component; val4.itemText = (TMP_Text)(object)val22; val4.options = options.Select((Func<string, OptionData>)((string o) => new OptionData(o))).ToList(); val7.SetActive(false); return val4; } private TMP_Text CreateTag(string s, Transform parent) { //IL_0017: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIElement("Tag", parent); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = _accentBlue; LayoutElement val3 = val.AddComponent<LayoutElement>(); val3.minWidth = 100f; val3.minHeight = 22f; TMP_Text val4 = CreateText(s.ToUpperInvariant(), 14, val.transform, (FontStyles)1); val4.alignment = (TextAlignmentOptions)514; val4.enableWordWrapping = false; val4.overflowMode = (TextOverflowModes)1; RectTransform rectTransform = val4.rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; return val4; } private void TakeCursor() { //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) _prevLock = Cursor.lockState; _prevVisible = Cursor.visible; Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } private void RestoreCursor() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) Cursor.lockState = _prevLock; Cursor.visible = _prevVisible; } private static string ToB64(string s) { return Convert.ToBase64String(Encoding.UTF8.GetBytes(s ?? "")); } private static string FromB64(string s) { try { return Encoding.UTF8.GetString(Convert.FromBase64String(s)); } catch { return s ?? ""; } } private void SaveEntries() { try { using StreamWriter streamWriter = new StreamWriter(_savePath, append: false, Encoding.UTF8); streamWriter.WriteLine("v2"); for (int i = 0; i < _entries.Count; i++) { CaptureEntry captureEntry = _entries[i]; streamWriter.Write(captureEntry.Seq); streamWriter.Write('|'); streamWriter.Write(ToB64(captureEntry.Kind)); streamWriter.Write('|'); streamWriter.Write(ToB64(captureEntry.Name)); streamWriter.Write('|'); streamWriter.Write(captureEntry.TimeUtc.Ticks); streamWriter.Write('\n'); } } catch (Exception arg) { Logger.LogWarning((object)$"RepoDex save failed: {arg}"); } } private void LoadEntries() { try { if (!File.Exists(_savePath)) { return; } string[] array = File.ReadAllLines(_savePath, Encoding.UTF8); int num = 0; if (array.Length != 0 && array[0].Trim().Equals("v2", StringComparison.OrdinalIgnoreCase)) { num = 1; } _entries.Clear(); _seen.Clear(); for (int i = num; i < array.Length; i++) { string text = array[i]; if (!string.IsNullOrWhiteSpace(text)) { string[] array2 = text.Split('|'); if (array2.Length >= 4 && int.TryParse(array2[0], out var result) && long.TryParse(array2[3], out var result2)) { string text2 = FromB64(array2[1]); string text3 = FromB64(array2[2]); CaptureEntry captureEntry = default(CaptureEntry); captureEntry.Seq = result; captureEntry.Kind = (string.IsNullOrEmpty(text2) ? "Object" : text2); captureEntry.Name = (string.IsNullOrEmpty(text3) ? "Unknown" : text3); captureEntry.TimeUtc = new DateTime(result2, DateTimeKind.Utc); CaptureEntry item = captureEntry; _entries.Add(item); _seen.Add(item.Kind + "|" + item.Name); } } } _entries.Sort((CaptureEntry a, CaptureEntry b) => a.Seq.CompareTo(b.Seq)); } catch (Exception arg) { Logger.LogWarning((object)$"RepoDex load failed: {arg}"); } } } internal sealed class RepoDexRuntime : MonoBehaviour { private static RepoDexRuntime _inst; private bool _wasActive; internal static Action OnEntriesChanged; private void Awake() { if (Object.op_Implicit((Object)(object)_inst) && (Object)(object)_inst != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _inst = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); SceneManager.activeSceneChanged += OnSceneChanged; } private void OnDestroy() { SceneManager.activeSceneChanged -= OnSceneChanged; FullDeactivate(); } private static void OnSceneChanged(Scene a, Scene b) { FullDeactivate(); } private void OnDisable() { FullDeactivate(); } private void Update() { RepoDexPlugin instance = RepoDexPlugin.Instance; if (!Object.op_Implicit((Object)(object)instance)) { return; } if (!RuntimeReady()) { if (_wasActive) { FullDeactivate(); } } else if (!_wasActive) { TryActivate(); } } internal static bool RuntimeReady() { if (!PhotonNetwork.IsConnected || !PhotonNetwork.InRoom) { return false; } if (SemiFunc.MenuLevel()) { return false; } if (!Object.op_Implicit((Object)(object)LevelGenerator.Instance) || !LevelGenerator.Instance.Generated) { return false; } if (!Object.op_Implicit((Object)(object)PlayerAvatar.instance)) { return false; } return true; } internal static void TryActivate() { RepoDexPlugin instance = RepoDexPlugin.Instance; if (Object.op_Implicit((Object)(object)instance)) { instance.ActivateRuntime(); if (Object.op_Implicit((Object)(object)_inst)) { _inst._wasActive = true; } OnEntriesChanged?.Invoke(); } } internal static void FullDeactivate() { RepoDexPlugin instance = RepoDexPlugin.Instance; if (Object.op_Implicit((Object)(object)instance)) { instance.DeactivateRuntime(); if (Object.op_Implicit((Object)(object)_inst)) { _inst._wasActive = false; } } } } public class RepoDexReceiver : MonoBehaviour { public void AddLocal(string kind, string name) { if (Object.op_Implicit((Object)(object)RepoDexPlugin.Instance)) { RepoDexPlugin.Instance.AddEntry(kind, string.IsNullOrWhiteSpace(name) ? "Unknown" : name.Trim(), DateTime.UtcNow); } } public void AddLocalDetailed(string usedKind, string usedName, string targetKind, string targetName) { if (Object.op_Implicit((Object)(object)RepoDexPlugin.Instance)) { string kind = (string.IsNullOrWhiteSpace(targetKind) ? usedKind : targetKind); string name = (string.IsNullOrWhiteSpace(targetName) ? "Unknown" : targetName.Trim()); RepoDexPlugin.Instance.AddEntry(kind, name, DateTime.UtcNow); } } } } namespace Omniscye.RepoBall { [BepInPlugin("Omniscye.RepoBall", "RepoBall", "1.0.5")] public class RepoBallPlugin : BaseUnityPlugin { internal const byte RepoDexEventCode = 187; internal static RepoBallPlugin Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_004d: Expected O, but got Unknown Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} loaded"); } private void OnDestroy() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { RepoDexBridge.FlushPending(); } internal static void BroadcastRepoDex(string kind, string name) { BroadcastRepoDexDetailed("Item", "RepoBall", kind, name); } internal static void BroadcastRepoDexDetailed(string kind, string usedName, string targetKind, string targetName) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer()) { object[] array = new object[5] { kind, usedName, DateTime.UtcNow.Ticks, string.IsNullOrWhiteSpace(targetKind) ? "Object" : targetKind.Trim(), string.IsNullOrWhiteSpace(targetName) ? "Unknown" : targetName.Trim() }; RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent((byte)187, (object)array, val, SendOptions.SendReliable); } } } public class RepoPokeball : Trap { private struct RepoTarget { public GameObject Target; public RepoTargetKind Kind; public RepoTarget(GameObject go, RepoTargetKind k) { Target = go; Kind = k; } } private class TargetState { public GameObject Target; public RepoTargetKind Kind; public Transform Transform; public Transform Parent; public Vector3 LocalPos; public Quaternion LocalRot; public Vector3 LocalScale; public Vector3 WorldPos; public Quaternion WorldRot; public PhotonView PV; public Enemy Enemy; public PlayerAvatar Player; public ValuableObject Valuable; public PhysGrabObject Phys; public EnemyParent EnemyParent; public EnemyOnScreen EnemyOnScreen; public EnemyPlayerDistance EnemyPlayerDistance; public bool EnemyParentEnabled; public bool EnemyOnScreenEnabled; public bool EnemyPlayerDistanceEnabled; public List<Behaviour> DisabledBehaviours; } private enum RepoTargetKind { None, Enemy, Player, Valuable, Item } [CompilerGenerated] private sealed class <CaptureRoutine>d__29 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public RepoTarget target; public RepoPokeball <>4__this; private Vector3 <ballPos>5__1; private Vector3 <floatPos>5__2; private TargetState <info>5__3; private bool <success>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CaptureRoutine>d__29(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <info>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00d6: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this._busy = true; <>4__this._armTimer = 0f; if (Object.op_Implicit((Object)(object)<>4__this.hitSound)) { <>4__this._audio.PlayOneShot(<>4__this.hitSound, Mathf.Clamp01(<>4__this.volume)); } <ballPos>5__1 = ((Component)<>4__this).transform.position; <floatPos>5__2 = <ballPos>5__1 + Vector3.up * <>4__this.floatHeight; if (Object.op_Implicit((Object)(object)<>4__this._rb)) { <>4__this._rb.isKinematic = true; <>4__this._rb.velocity = Vector3.zero; <>4__this._rb.angularVelocity = Vector3.zero; } ((Component)<>4__this).transform.position = <floatPos>5__2; if (<>4__this.suckTime > 0f) { <>2__current = (object)new WaitForSeconds(<>4__this.suckTime); <>1__state = 1; return true; } goto IL_0182; case 1: <>1__state = -1; goto IL_0182; case 2: <>1__state = -1; <>2__current = <>4__this.ShakeBall(); <>1__state = 3; return true; case 3: <>1__state = -1; ((Trap)<>4__this).photonView.RPC("RPC_CaptureResult", (RpcTarget)1, new object[1] { <success>5__4 }); if (<success>5__4) { if (Object.op_Implicit((Object)(object)<>4__this.captureSound)) { <>4__this._audio.PlayOneShot(<>4__this.captureSound, Mathf.Clamp01(<>4__this.volume)); } <>4__this.FinalizeSuccess(<info>5__3, target); break; } if (Object.op_Implicit((Object)(object)<>4__this.breakSound)) { <>4__this._audio.PlayOneShot(<>4__this.breakSound, Mathf.Clamp01(<>4__this.volume)); } <>2__current = <>4__this.ReleaseTarget(<info>5__3); <>1__state = 4; return true; case 4: { <>1__state = -1; break; } IL_0182: <info>5__3 = <>4__this.PrepareTarget(target); <success>5__4 = Random.Range(0, 2) == 0; <>2__current = <>4__this.SuckTarget(<info>5__3); <>1__state = 2; return true; } if (Object.op_Implicit((Object)(object)<>4__this._rb)) { <>4__this._rb.isKinematic = false; } <>4__this._busy = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ReleaseTarget>d__36 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TargetState st; public RepoPokeball <>4__this; private Vector3 <endPos>5__1; private Quaternion <endRot>5__2; private Vector3 <endScale>5__3; private int <i>5__4; private Behaviour <b>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ReleaseTarget>d__36(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <b>5__5 = null; <>1__state = -2; } private bool MoveNext() { //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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0090: 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_00c7: Expected O, but got Unknown //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <endPos>5__1 = st.WorldPos; <endRot>5__2 = st.WorldRot; <endScale>5__3 = st.LocalScale; st.Transform.position = <endPos>5__1; st.Transform.rotation = <endRot>5__2; st.Transform.localScale = <endScale>5__3; if (<>4__this.suckTime > 0f) { <>2__current = (object)new WaitForSeconds(<>4__this.suckTime); <>1__state = 1; return true; } break; case 1: <>1__state = -1; break; } if (SemiFunc.IsMultiplayer()) { ((Trap)<>4__this).photonView.RPC("RPC_SetScale", (RpcTarget)1, new object[2] { Object.op_Implicit((Object)(object)st.PV) ? st.PV.ViewID : (-1), st.LocalScale }); } st.Transform.SetParent(st.Parent, true); st.Transform.localScale = st.LocalScale; if (Object.op_Implicit((Object)(object)st.Phys) && Object.op_Implicit((Object)(object)st.Phys.rb)) { st.Phys.rb.isKinematic = false; } if (Object.op_Implicit((Object)(object)st.EnemyParent)) { ((Behaviour)st.EnemyParent).enabled = st.EnemyParentEnabled; } if (Object.op_Implicit((Object)(object)st.EnemyOnScreen)) { ((Behaviour)st.EnemyOnScreen).enabled = st.EnemyOnScreenEnabled; } if (Object.op_Implicit((Object)(object)st.EnemyPlayerDistance)) { ((Behaviour)st.EnemyPlayerDistance).enabled = st.EnemyPlayerDistanceEnabled; } if (st.DisabledBehaviours != null) { <i>5__4 = 0; while (<i>5__4 < st.DisabledBehaviours.Count) { <b>5__5 = st.DisabledBehaviours[<i>5__4]; if (Object.op_Implicit((Object)(object)<b>5__5)) { <b>5__5.enabled = true; } <b>5__5 = null; <i>5__4++; } } if (Object.op_Implicit((Object)(object)st.Enemy)) { ((Behaviour)st.Enemy).enabled = true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ShakeBall>d__34 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public RepoPokeball <>4__this; private Quaternion <baseRot>5__1; private int <i>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ShakeBall>d__34(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <baseRot>5__1 = ((Component)<>4__this).transform.rotation; <i>5__2 = 0; goto IL_01a8; case 1: <>1__state = -1; goto IL_00cf; case 2: <>1__state = -1; goto IL_0142; case 3: { <>1__state = -1; goto IL_0195; } IL_01a8: if (<i>5__2 < 3) { ((Component)<>4__this).transform.rotation = <baseRot>5__1 * Quaternion.Euler(0f, 0f, <>4__this.tiltAngle); if (<>4__this.tiltTime > 0f) { <>2__current = (object)new WaitForSeconds(<>4__this.tiltTime); <>1__state = 1; return true; } goto IL_00cf; } ((Component)<>4__this).transform.rotation = <baseRot>5__1; return false; IL_0195: <i>5__2++; goto IL_01a8; IL_0142: ((Component)<>4__this).transform.rotation = <baseRot>5__1; if (<>4__this.tiltTime > 0f) { <>2__current = (object)new WaitForSeconds(<>4__this.tiltTime); <>1__state = 3; return true; } goto IL_0195; IL_00cf: ((Component)<>4__this).transform.rotation = <baseRot>5__1 * Quaternion.Euler(0f, 0f, 0f - <>4__this.tiltAngle); if (<>4__this.tiltTime > 0f) { <>2__current = (object)new WaitForSeconds(<>4__this.tiltTime); <>1__state = 2; return true; } goto IL_0142; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <SuckTarget>d__33 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TargetState st; public RepoPokeball <>4__this; private Vector3 <endPos>5__1; private Quaternion <endRot>5__2; private Vector3 <endScale>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SuckTarget>d__33(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0045: 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_0054: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <endPos>5__1 = ((Component)<>4__this).transform.position; <endRot>5__2 = Quaternion.identity; <endScale>5__3 = Vector3.one * 0.01f; st.Transform.position = <endPos>5__1; st.Transform.rotation = <endRot>5__2; st.Transform.localScale = <endScale>5__3; st.Transform.SetParent(((Component)<>4__this).transform, true); if (SemiFunc.IsMultiplayer()) { ((Trap)<>4__this).photonView.RPC("RPC_SetScale", (RpcTarget)1, new object[2] { Object.op_Implicit((Object)(object)st.PV) ? st.PV.ViewID : (-1), <endScale>5__3 }); } if (<>4__this.suckTime > 0f) { <>2__current = (object)new WaitForSeconds(<>4__this.suckTime); <>1__state = 1; return true; } break; case 1: <>1__state = -1; break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public AudioClip hitSound; public AudioClip breakSound; public AudioClip captureSound; public float volume = 0.2f; public float captureChance = 0.5f; public float armTime = 2f; public float floatHeight = 1.2f; public float suckTime = 0.4f; public float tiltAngle = 18f; public float tiltTime = 0.35f; public float targetCooldown = 1f; public float rpcMinInterval = 0.12f; private AudioSource _audio; private bool _grabbedPrev; private float _armTimer; private bool _busy; private Rigidbody _rb; private float _nextRpcTime; private static readonly Dictionary<int, float> GlobalCooldown = new Dictionary<int, float>(); private static readonly object GlobalLock = new object(); private readonly Dictionary<int, float> _localCooldown = new Dictionary<int, float>(); public override void Start() { ((Trap)this).Start(); _audio = ((Component)this).GetComponent<AudioSource>(); if (!Object.op_Implicit((Object)(object)_audio)) { _audio = ((Component)this).gameObject.AddComponent<AudioSource>(); } _audio.playOnAwake = false; _audio.loop = false; _audio.spatialBlend = 1f; _audio.rolloffMode = (AudioRolloffMode)0; _audio.minDistance = 4f; _audio.maxDistance = 28f; _rb = ((Component)this).GetComponent<Rigidbody>(); } public override void Update() { ((Trap)this).Update(); _armTimer -= Time.deltaTime; bool flag = (Object)(object)base.physGrabObject != (Object)null && base.physGrabObject.grabbed; if (!flag && _grabbedPrev) { _armTimer = armTime; } _grabbedPrev = flag; } private void OnCollisionEnter(Collision c) { if (!_busy && (!((Object)(object)base.physGrabObject != (Object)null) || !base.physGrabObject.grabbed) && !(_armTimer <= 0f)) { Transform transform = c.transform; if (Object.op_Implicit((Object)(object)transform) && !((Object)(object)transform == (Object)(object)((Component)this).transform)) { TryBeginCapture(((Component)transform).gameObject); } } } private int GetTargetKey(GameObject go) { if (!Object.op_Implicit((Object)(object)go)) { return 0; } PhotonView componentInParent = go.GetComponentInParent<PhotonView>(); return Object.op_Implicit((Object)(object)componentInParent) ? componentInParent.ViewID : ((Object)go).GetInstanceID(); } private bool IsCooling(int key) { if (key == 0) { return false; } float unscaledTime = Time.unscaledTime; if (_localCooldown.TryGetValue(key, out var value) && value > unscaledTime) { return true; } lock (GlobalLock) { if (GlobalCooldown.TryGetValue(key, out var value2) && value2 > unscaledTime) { return true; } } return false; } private void ArmCooldown(int key) { if (key == 0) { return; } float num = Time.unscaledTime + Mathf.Max(0.01f, targetCooldown); _localCooldown[key] = num; lock (GlobalLock) { if (!GlobalCooldown.TryGetValue(key, out var value) || value < num) { GlobalCooldown[key] = num; } } } private void TryBeginCapture(GameObject hit) { if (_busy) { return; } RepoTarget target = ResolveTarget(hit); if ((Object)(object)target.Target == (Object)null) { return; } int targetKey = GetTargetKey(target.Target); if (IsCooling(targetKey)) { return; } if (SemiFunc.IsMultiplayer() && !PhotonNetwork.IsMasterClient) { if (!(Time.unscaledTime < _nextRpcTime)) { _nextRpcTime = Time.unscaledTime + Mathf.Max(0.01f, rpcMinInterval); PhotonView componentInParent = target.Target.GetComponentInParent<PhotonView>(); ArmCooldown(targetKey); base.photonView.RPC("RPC_BeginCapture", (RpcTarget)2, new object[2] { Object.op_Implicit((Object)(object)componentInParent) ? componentInParent.ViewID : (-1), (int)target.Kind }); } } else { ArmCooldown(targetKey); ((MonoBehaviour)this).StartCoroutine(CaptureRoutine(target)); } } [PunRPC] private void RPC_BeginCapture(int viewID, int kindInt) { if (_busy || viewID == -1) { return; } PhotonView val = PhotonView.Find(viewID); if (Object.op_Implicit((Object)(object)val)) { if (!IsCooling(viewID)) { ArmCooldown(viewID); ((MonoBehaviour)this).StartCoroutine(CaptureRoutine(new RepoTarget(((Component)val).gameObject, (RepoTargetKind)kindInt))); } } } [IteratorStateMachine(typeof(<CaptureRoutine>d__29))] private IEnumerator CaptureRoutine(RepoTarget target) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CaptureRoutine>d__29(0) { <>4__this = this, target = target }; } [PunRPC] private void RPC_CaptureResult(bool success) { if (success) { if (Object.op_Implicit((Object)(object)captureSound)) { _audio.PlayOneShot(captureSound, Mathf.Clamp01(volume)); } } else if (Object.op_Implicit((Object)(object)breakSound)) { _audio.PlayOneShot(breakSound, Mathf.Clamp01(volume)); } } private RepoTarget ResolveTarget(GameObject hit) { EnemyParent componentInParent = hit.GetComponentInParent<EnemyParent>(); if (Object.op_Implicit((Object)(object)componentInParent)) { return new RepoTarget(((Component)componentInParent).gameObject, RepoTargetKind.Enemy); } Enemy componentInParent2 = hit.GetComponentInParent<Enemy>(); if (Object.op_Implicit((Object)(object)componentInParent2)) { return new RepoTarget(((Component)componentInParent2).gameObject, RepoTargetKind.Enemy); } PlayerAvatar componentInParent3 = hit.GetComponentInParent<PlayerAvatar>(); if (Object.op_Implicit((Object)(object)componentInParent3)) { return new RepoTarget(((Component)componentInParent3).gameObject, RepoTargetKind.Player); } ValuableObject componentInParent4 = hit.GetComponentInParent<ValuableObject>(); if (Object.op_Implicit((Object)(object)componentInParent4)) { return new RepoTarget(((Component)componentInParent4).gameObject, RepoTargetKind.Valuable); } PhysGrabObject componentInParent5 = hit.GetComponentInParent<PhysGrabObject>(); if (Object.op_Implicit((Object)(object)componentInParent5)) { return new RepoTarget(((Component)componentInParent5).gameObject, RepoTargetKind.Item); } return new RepoTarget(null, RepoTargetKind.None); } private TargetState PrepareTarget(RepoTarget target) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: 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) TargetState targetState = new TargetState { Target = target.Target, Kind = target.Kind, Transform = target.Target.transform, Parent = target.Target.transform.parent, LocalPos = target.Target.transform.localPosition, LocalRot = target.Target.transform.localRotation, LocalScale = target.Target.transform.localScale, WorldPos = target.Target.transform.position, WorldRot = target.Target.transform.rotation, PV = target.Target.GetComponentInParent<PhotonView>(), Enemy = target.Target.GetComponentInParent<Enemy>(), Player = target.Target.GetComponentInParent<PlayerAvatar>(), Valuable = target.Target.GetComponentInParent<ValuableObject>(), Phys = target.Target.GetComponentInParent<PhysGrabObject>(), EnemyParent = target.Target.GetComponentInParent<EnemyParent>(), EnemyOnScreen = target.Target.GetComponentInParent<EnemyOnScreen>(), EnemyPlayerDistance = target.Target.GetComponentInParent<EnemyPlayerDistance>() }; if (Object.op_Implicit((Object)(object)targetState.Phys)) { if (targetState.Phys.playerGrabbing != null) { for (int i = 0; i < targetState.Phys.playerGrabbing.Count; i++) { PhysGrabber val = targetState.Phys.playerGrabbing[i]; if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)targetState.PV)) { val.ReleaseObject(targetState.PV.ViewID, 0.05f); } } } if (Object.op_Implicit((Object)(object)targetState.Phys.rb)) { targetState.Phys.rb.velocity = Vector3.zero; targetState.Phys.rb.angularVelocity = Vector3.zero; targetState.Phys.rb.isKinematic = true; } } if (Object.op_Implicit((Object)(object)targetState.Enemy)) { targetState.Enemy.FreezeTimer = 2f; } if (Object.op_Implicit((Object)(object)targetState.EnemyParent)) { targetState.EnemyParentEnabled = ((Behaviour)targetState.EnemyParent).enabled; ((Behaviour)targetState.EnemyParent).enabled = false; ((MonoBehaviour)targetState.EnemyParent).StopAllCoroutines(); } if (Object.op_Implicit((Object)(object)targetState.EnemyOnScreen)) { targetState.EnemyOnScreenEnabled = ((Behaviour)targetState.EnemyOnScreen).enabled; ((Behaviour)targetState.EnemyOnScreen).enabled = false; ((MonoBehaviour)targetState.EnemyOnScreen).StopAllCoroutines(); } if (Object.op_Implicit((Object)(object)targetState.EnemyPlayerDistance)) { targetState.EnemyPlayerDistanceEnabled = ((Behaviour)targetState.EnemyPlayerDistance).enabled; ((Behaviour)targetState.EnemyPlayerDistance).enabled = false; ((MonoBehaviour)targetState.EnemyPlayerDistance).StopAllCoroutines(); } if (Object.op_Implicit((Object)(object)targetState.Player)) { PlayerHealth playerHealth = targetState.Player.playerHealth; if (Object.op_Implicit((Object)(object)playerHealth)) { playerHealth.HurtFreezeOverride(1.5f); } } if (Object.op_Implicit((Object)(object)targetState.Enemy)) { ((Behaviour)targetState.Enemy).enabled = false; ((MonoBehaviour)targetState.Enemy).StopAllCoroutines(); targetState.DisabledBehaviours = new List<Behaviour>(); Behaviour[] componentsInChildren = targetState.Target.GetComponentsInChildren<Behaviour>(true); foreach (Behaviour val2 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val2) && val2 != targetState.Enemy && !(val2 is PhotonView) && val2.enabled) { val2.enabled = false; targetState.DisabledBehaviours.Add(val2); } } } return targetState; } [IteratorStateMachine(typeof(<SuckTarget>d__33))] private IEnumerator SuckTarget(TargetState st) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SuckTarget>d__33(0) { <>4__this = this, st = st }; } [IteratorStateMachine(typeof(<ShakeBall>d__34))] private IEnumerator ShakeBall() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ShakeBall>d__34(0) { <>4__this = this }; } private void FinalizeSuccess(TargetState st, RepoTarget target) { //IL_009e: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) string text = target.Kind.ToString(); string targetNameStrict = GetTargetNameStrict(st, target.Kind); RepoDexBridge.AddLocalDetailed("Item", "RepoBall", text, targetNameStrict); if (SemiFunc.IsMultiplayer()) { object[] array = new object[5] { "Item", "RepoBall", DateTime.UtcNow.Ticks, string.IsNullOrWhiteSpace(text) ? "Object" : text.Trim(), string.IsNullOrWhiteSpace(targetNameStrict) ? "Unknown" : targetNameStrict.Trim() }; RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)0 }; PhotonNetwork.RaiseEvent((byte)187, (object)array, val, SendOptions.SendReliable); } if (Object.op_Implicit((Object)(object)st.PV) && PhotonNetwork.IsMasterClient) { PhotonNetwork.Destroy(st.PV); } else { Object.Destroy((Object)(object)st.Target); } } [IteratorStateMachine(typeof(<ReleaseTarget>d__36))] private IEnumerator ReleaseTarget(TargetState st) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ReleaseTarget>d__36(0) { <>4__this = this, st = st }; } private string GetTargetNameStrict(TargetState st, RepoTargetKind kind) { switch (kind) { case RepoTargetKind.Player: if (Object.op_Implicit((Object)(object)st.Player) && Object.op_Implicit((Object)(object)st.Player.photonView) && st.Player.photonView.Owner != null) { return st.Player.photonView.Owner.NickName; } return ((Object)st.Target).name; case RepoTargetKind.Item: { ItemAttributes componentInParent2 = st.Target.GetComponentInParent<ItemAttributes>(); if (Object.op_Implicit((Object)(object)componentInParent2)) { if ((Object)(object)componentInParent2.item != (Object)null && !string.IsNullOrEmpty(componentInParent2.item.itemName)) { return componentInParent2.item.itemName; } if (!string.IsNullOrEmpty(componentInParent2.itemName)) { return componentInParent2.itemName; } } return ((Object)st.Target).name; } case RepoTargetKind.Enemy: if (Object.op_Implicit((Object)(object)st.EnemyParent) && !string.IsNullOrEmpty(st.EnemyParent.enemyName)) { return st.EnemyParent.enemyName; } return ((Object)st.Target).name; default: { ValuableObject componentInParent = st.Target.GetComponentInParent<ValuableObject>(); if (Object.op_Implicit((Object)(object)componentInParent)) { return ((Object)st.Target).name; } return ((Object)st.Target).name; } } } [PunRPC] private void RPC_SetScale(int viewID, Vector3 scale) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (viewID != -1) { PhotonView val = PhotonView.Find(viewID); if (Object.op_Implicit((Object)(object)val)) { ((Component)val).transform.localScale = scale; } } } } public static class RepoDexBridge { private struct Pending { public string UsedKind; public string UsedName; public string TargetKind; public string TargetName; } private static readonly List<Pending> _pending = new List<Pending>(); private static GameObject FindReceiver() { return GameObject.Find("RepoDexReceiver_EMPRESS"); } public static void AddLocal(string kind, string name) { GameObject val = FindReceiver(); if (!Object.op_Implicit((Object)(object)val)) { _pending.Add(new Pending { UsedKind = kind, UsedName = name, TargetKind = kind, TargetName = name }); return; } RepoDexReceiver component = val.GetComponent<RepoDexReceiver>(); if (!Object.op_Implicit((Object)(object)component)) { _pending.Add(new Pending { UsedKind = kind, UsedName = name, TargetKind = kind, TargetName = name }); } else { component.AddLocal(kind, name); } } public static void AddLocalDetailed(string usedKind, string usedName, string targetKind, string targetName) { GameObject val = FindReceiver(); if (!Object.op_Implicit((Object)(object)val)) { _pending.Add(new Pending { UsedKind = usedKind, UsedName = usedName, TargetKind = targetKind, TargetName = targetName }); return; } RepoDexReceiver component = val.GetComponent<RepoDexReceiver>(); if (!Object.op_Implicit((Object)(object)component)) { _pending.Add(new Pending { UsedKind = usedKind, UsedName = usedName, TargetKind = targetKind, TargetName = targetName }); } else { component.AddLocalDetailed(usedKind, usedName, targetKind, targetName); } } public static void FlushPending() { if (_pending.Count == 0) { return; } GameObject val = FindReceiver(); if (!Object.op_Implicit((Object)(object)val)) { return; } RepoDexReceiver component = val.GetComponent<RepoDexReceiver>(); if (Object.op_Implicit((Object)(object)component)) { for (int i = 0; i < _pending.Count; i++) { Pending pending = _pending[i]; component.AddLocalDetailed(pending.UsedKind, pending.UsedName, pending.TargetKind, pending.TargetName); } _pending.Clear(); } } } }