Decompiled source of Peak Sentinel v1.1.6
plugins/PeakSentinel.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DG.Tweening; using DG.Tweening.Core; using DG.Tweening.Plugins.Options; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Peak; using Peak.Afflictions; using Peak.Network; using PeakSentinel.Compat; using PeakSentinel.Detection; using PeakSentinel.Detection.Flight; using PeakSentinel.Detection.Stamina; using PeakSentinel.Game; using PeakSentinel.Network; using PeakSentinel.Patches; using PeakSentinel.Protection; using PeakSentinel.Reporting; using PeakSentinel.Settings; using PeakSentinel.Speedrun; using PeakSentinel.Ui; using PeakSentinel.Ui.Pages; using Photon.Pun; using Photon.Realtime; using Portningsbolaget; using Portningsbolaget.Platforms; using Steamworks; using TMPro; using Unity.Mathematics; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.UI; using UnityEngine.InputSystem.Utilities; using UnityEngine.SceneManagement; using UnityEngine.UI; using Zorro.Core; using Zorro.Core.Serizalization; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PeakSentinel")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+9284631a847c77a2874e72ef36df28d62f520bf6")] [assembly: AssemblyProduct("PeakSentinel")] [assembly: AssemblyTitle("PeakSentinel")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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 PeakSentinel { [BepInPlugin("peaksentinel", "Peak Sentinel", "1.1.6")] public sealed class SentinelPlugin : BaseUnityPlugin { public const string Guid = "peaksentinel"; public const string Name = "Peak Sentinel"; public const string Version = "1.1.6"; private const string TraceFile = "PeakSentinel.log"; private const string BansFile = "PeakSentinel.bans.txt"; private Harmony _harmony; private DebugTrace _trace; private void Awake() { //IL_009b: 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: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown SentinelSettings sentinelSettings = new SentinelSettings(((BaseUnityPlugin)this).Config, "PeakSentinel.log"); _trace = new DebugTrace(Path.Combine(Paths.BepInExRootPath, "PeakSentinel.log"), sentinelSettings.Debug.TraceFile, sentinelSettings.Debug.TraceAllRpcs); FindingLog findings = new FindingLog(sentinelSettings.Manager.LogEntries); TrustList trust = new TrustList(); SuspicionReport report = new SuspicionReport(((BaseUnityPlugin)this).Logger, _trace, findings, trust); SentinelHooks.Findings = findings; SentinelHooks.Report = report; SentinelHooks.Environment = new EnvironmentMarks(); SentinelHooks.Traps = new EnvironmentMarks(); SentinelHooks.Portals = new PeakPortals(); GameObject val = new GameObject("Peak Sentinel") { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)(object)val); ForeignObjects objects = new ForeignObjects(); StateLedger ledger = new StateLedger(objects); MuteList mutes = new MuteList(report, ledger); LatencyMeter latency = new LatencyMeter(); SpawnClock spawns = val.AddComponent<SpawnClock>(); TrueAscentState ascent = new TrueAscentState(); SelfResync selfResync = new SelfResync(val.AddComponent<DelayedCalls>()); GuardPackets(sentinelSettings, report, mutes, latency); AuditRpcs(val, sentinelSettings, report, spawns, ledger, objects, ascent, selfResync); WindowServices services = Watch(val, sentinelSettings, report, findings, mutes, latency, ledger, spawns, ascent, selfResync); OpenWindow(val, sentinelSettings, services); _harmony = new Harmony("peaksentinel"); _harmony.PatchAll(typeof(SentinelPlugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0} {1} loaded: block cheat spawns {2}, trace in {3}", "Peak Sentinel", "1.1.6", sentinelSettings.Protection.BlockCheatSpawns.Value, _trace.Path)); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } _trace?.Dispose(); } private void GuardPackets(SentinelSettings settings, SuspicionReport report, MuteList mutes, LatencyMeter latency) { SentinelHooks.Mutes = mutes; SentinelHooks.Gate = new PacketGate(report, settings.Detection, settings.Flood, mutes, latency, SentinelHooks.Traps); } private void AuditRpcs(GameObject host, SentinelSettings settings, SuspicionReport report, SpawnClock spawns, StateLedger ledger, ForeignObjects objects, TrueAscentState ascent, SelfResync selfResync) { DetectionSettings detection = settings.Detection; ItemLocator locator = new ItemLocator(); CookingEchoes cooking = new CookingEchoes(); CheatKills kills = new CheatKills(); SpawnBlame blame = new SpawnBlame(); ItemUseLedger itemUseLedger = new ItemUseLedger(); VictimGuard guard = new VictimGuard(report, selfResync); LegitForces forces = new LegitForces(locator, cooking, SentinelHooks.Traps, blame); AreaEffects areaEffects = new AreaEffects(locator); ItemRpcAudit itemRpcAudit = new ItemRpcAudit(report, settings.Protection, spawns, new BackpackSwap()); HandGuard handGuard = new HandGuard(report, settings.Protection); EffectAudit effectAudit = host.AddComponent<EffectAudit>(); effectAudit.Initialize(report, _trace, detection, itemRpcAudit, areaEffects, locator, ascent, spawns); StatusAudit statusAudit = host.AddComponent<StatusAudit>(); statusAudit.Initialize(report, detection, locator, ascent); SentinelHooks.Hands = handGuard; SentinelHooks.Cooking = cooking; DaggerFeeds daggerFeeds = new DaggerFeeds(); SentinelHooks.Instantiate = new InstantiateAudit(report, _trace, detection, settings.Protection, itemRpcAudit, objects, locator, ascent, blame, itemUseLedger, daggerFeeds); KickClock kickClock = new KickClock(); SentinelHooks.Router = new RpcRouter(_trace, ledger, report.Trust, () => detection.CheckMyself.Value, new SyncDataGuard(report), kickClock, itemRpcAudit, handGuard, new KickShield(report, settings.Other, ascent, kickClock), new CarryShield(report, settings.Other), new DaggerShield(report, settings.Other), daggerFeeds, new HarmAudit(report, guard, detection, locator, forces, cooking, ascent, kills, host.AddComponent<DelayedCalls>()), new WorldAudit(report, guard, detection, SentinelHooks.Portals), new ControlAudit(guard, detection), new CarryAudit(guard, detection), new BuildAudit(report, detection, settings.Flood), new ReviveAudit(guard, detection, spawns, ascent, kills), new PushAudit(guard, detection, forces, kickClock), new ItemUseAudit(guard, detection, itemUseLedger, host.AddComponent<StatusRestorer>()), new BalloonAudit(report, guard, detection, settings.Protection, spawns, objects), new KnockdownAudit(report, guard, detection, forces, SentinelHooks.Environment, kickClock, blame, spawns), areaEffects, effectAudit, statusAudit); } private WindowServices Watch(GameObject host, SentinelSettings settings, SuspicionReport report, FindingLog findings, MuteList mutes, LatencyMeter latency, StateLedger ledger, SpawnClock spawns, TrueAscentState ascent, SelfResync selfResync) { BanList bans = new BanList(Path.Combine(Paths.ConfigPath, "PeakSentinel.bans.txt")); PlayerKicker kicker = host.AddComponent<PlayerKicker>(); host.AddComponent<HostGuard>().Initialize(report, settings.Other, kicker); SentinelPresence sentinelPresence = host.AddComponent<SentinelPresence>(); sentinelPresence.Initialize(report, "1.1.6"); DesyncFixer desyncFixer = host.AddComponent<DesyncFixer>(); desyncFixer.Initialize(report, settings.Other, ledger, new CarryReset(), selfResync); BanGuard banGuard = host.AddComponent<BanGuard>(); banGuard.Initialize(report, bans, mutes, kicker); host.AddComponent<CheatModScan>().Initialize(report, settings.Detection, kicker); host.AddComponent<IdentityAudit>().Initialize(report, settings.Detection); SentinelHooks.Invisibility = new InvisibilityAudit(report, settings.Detection); SentinelHooks.BodySync = new BodySyncGuard(report); FlightAudit flightAudit = host.AddComponent<FlightAudit>(); flightAudit.Initialize(report, _trace, settings.Detection, settings.Flight, new FlightExemptions(new RopeLinks(), SentinelHooks.Environment, spawns, ascent)); StaminaAudit staminaAudit = host.AddComponent<StaminaAudit>(); staminaAudit.Initialize(report, _trace, settings.Detection, settings.Stamina, ascent); LootLedger lootLedger = (SentinelHooks.Loot = new LootLedger(settings.Speedrun.TrackLuck)); SpeedrunMonitor speedrunMonitor = host.AddComponent<SpeedrunMonitor>(); speedrunMonitor.Initialize(settings.Speedrun, report, lootLedger, new RunJournal(Paths.BepInExRootPath, settings.Speedrun.RecordRun), flightAudit, staminaAudit); return new WindowServices(findings, report, bans, banGuard, kicker, new PlayerTeleporter(report), mutes, new ReportExport(Paths.BepInExRootPath, findings), latency, desyncFixer, sentinelPresence, lootLedger, ascent, speedrunMonitor); } private void OpenWindow(GameObject host, SentinelSettings settings, WindowServices services) { new ShieldGlyph().Register(); SentinelWindow sentinelWindow = host.AddComponent<SentinelWindow>(); sentinelWindow.Initialize("Peak Sentinel 1.1.6", settings, services); SentinelHooks.Window = sentinelWindow; host.AddComponent<SpeedrunOverlay>().Initialize(services.Report, services.Loot, services.Speedrun, settings.Speedrun, "1.1.6"); } } } namespace PeakSentinel.Ui { public sealed class AvatarBadge : MonoBehaviour { private const float MarkSize = 40f; private const float FontSize = 38f; private const float PulseScale = 1.3f; private const float PulseSeconds = 0.45f; private const string SuspectMark = "?"; private const string CheaterMark = "!"; private const string MutedMark = "X"; private const float CrossSize = 80f; private const float CrossLift = 8f; private static readonly Color MutedTint = new Color(0.4f, 0.4f, 0.4f, 1f); private static readonly Color CrossColor = new Color(0.12f, 0.1f, 0.08f, 0.9f); private RectTransform _avatar; private RectTransform _frame; private Image _avatarImage; private TextMeshProUGUI _mark; private TextMeshProUGUI _cross; private MuteList _mutes; private Player _player; private bool _shownMuted; private Tween _pulse; private FindingLog _findings; private int _actor; private PlayerStanding _shown; public void Initialize(Image avatar, Player player, FindingLog findings, MuteList mutes) { _player = player; _actor = player.ActorNumber; _findings = findings; _mutes = mutes; if ((Object)(object)_mark == (Object)null) { Build(avatar); } Show(_findings.StandingOf(_actor)); ShowMuted(_mutes.IsMuted(_player)); } private void Update() { //IL_000f: 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_0048: Unknown result type (might be due to invalid IL or missing references) if (_findings != null) { float num = Mathf.Sign(((Transform)_avatar).localScale.y); if (!Mathf.Approximately(((Transform)_frame).localScale.y, num)) { ((Transform)_frame).localScale = new Vector3(1f, num, 1f); } PlayerStanding playerStanding = _findings.StandingOf(_actor); if (playerStanding != _shown) { Show(playerStanding); } bool flag = _mutes.IsMuted(_player); if (flag != _shownMuted) { ShowMuted(flag); } } } private void OnDestroy() { Tween pulse = _pulse; if (pulse != null) { TweenExtensions.Kill(pulse, false); } } private void Build(Image avatar) { //IL_002c: 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_0063: 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_008d: 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_00bf: 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_00e3: 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_010d: 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) //IL_0157: 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_01a5: Unknown result type (might be due to invalid IL or missing references) _avatarImage = avatar; _avatar = ((Graphic)avatar).rectTransform; _frame = new GameObject("AvatarBadge", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)_frame).SetParent((Transform)(object)_avatar, false); _frame.anchorMin = Vector2.zero; _frame.anchorMax = Vector2.one; _frame.pivot = new Vector2(0.5f, 0.5f); _frame.offsetMin = Vector2.zero; _frame.offsetMax = Vector2.zero; RectTransform component = new GameObject("AvatarBadge", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)_frame, false); component.anchorMin = Vector2.one; component.anchorMax = Vector2.one; component.pivot = new Vector2(0.5f, 0.5f); component.sizeDelta = new Vector2(40f, 40f); component.anchoredPosition = Vector2.zero; _mark = Glyph(component); _cross = Glyph(_frame); ((TMP_Text)_cross).fontSize = 80f; ((Graphic)_cross).color = CrossColor; ((TMP_Text)_cross).text = "X"; ((TMP_Text)_cross).rectTransform.offsetMin = new Vector2(0f, 8f); ((TMP_Text)_cross).rectTransform.offsetMax = new Vector2(0f, 8f); ((TMP_Text)_cross).transform.SetAsFirstSibling(); } private void ShowMuted(bool muted) { //IL_0017: 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) _shownMuted = muted; ((Graphic)_avatarImage).color = (muted ? MutedTint : Color.white); if (muted) { ((Component)_cross).gameObject.SetActive(true); } else { ((Component)_cross).gameObject.SetActive(false); } } private TextMeshProUGUI Glyph(RectTransform holder) { //IL_0025: 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_0049: 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_005e: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI component = new GameObject("TextMeshProUGUI", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }).GetComponent<TextMeshProUGUI>(); RectTransform rectTransform = ((TMP_Text)component).rectTransform; ((Transform)rectTransform).SetParent((Transform)(object)holder, false); rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; ((TMP_Text)component).font = GameFonts.Main(); ((TMP_Text)component).fontSize = 38f; ((TMP_Text)component).alignment = (TextAlignmentOptions)514; ((TMP_Text)component).textWrappingMode = (TextWrappingModes)0; ((Graphic)component).raycastTarget = false; return component; } private void Show(PlayerStanding standing) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) _shown = standing; Tween pulse = _pulse; if (pulse != null) { TweenExtensions.Kill(pulse, false); } RectTransform val = (RectTransform)((Transform)((TMP_Text)_mark).rectTransform).parent; ((Transform)val).localScale = Vector3.one; switch (standing) { case PlayerStanding.Cheater: ((TMP_Text)_mark).text = "!"; ((Graphic)_mark).color = UiPalette.CheatBright; _pulse = (Tween)(object)TweenSettingsExtensions.SetUpdate<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetLoops<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOScale((Transform)(object)val, 1.3f, 0.45f), -1, (LoopType)1), true); break; case PlayerStanding.Suspect: ((TMP_Text)_mark).text = "?"; ((Graphic)_mark).color = UiPalette.SuspiciousBright; break; default: ((TMP_Text)_mark).text = string.Empty; break; } } } public sealed class AvatarCache { private const string UserIdProperty = "UserID"; private readonly Dictionary<string, Sprite> _avatars = new Dictionary<string, Sprite>(); private readonly HashSet<string> _requested = new HashSet<string>(); public int Version { get; private set; } public Sprite Of(Player player) { object obj = player.CustomProperties[(object)"UserID"]; string id = obj as string; if (id == null) { return null; } if (_avatars.TryGetValue(id, out var value)) { return value; } if (_requested.Add(id) && PlayerPlatforms.SharesMine(player) && ulong.TryParse(id, out var result)) { PlatformManager.Platform.GetAvatarAsync(result, (Action<Texture2D>)delegate(Texture2D texture) { Store(id, texture); }); } return null; } private void Store(string id, Texture2D texture) { //IL_002a: 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)texture == (Object)null)) { _avatars[id] = Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), new Vector2(0.5f, 0.5f)); Version++; } } } public sealed class CardSprites { private const int Size = 64; private const int Supersample = 4; private const float PixelsPerUnit = 100f; private const float PanelRadius = 16f; private const float CardRadius = 9f; private const float ButtonRadius = 10f; private const float BoxRadius = 8f; private const float MarkRadius = 6f; private const float BarRadius = 6f; private const float SliderRadius = 3f; private const float PanelOutline = 2.5f; private const float CardOutline = 1.5f; private const float InnerShare = 0.6f; private const float MaxBorder = 31f; public Sprite Panel { get; } public Sprite Card { get; } public Sprite CardHover { get; } public Sprite ButtonIdle { get; } public Sprite ButtonHover { get; } public Sprite ButtonSelected { get; } public Sprite Box { get; } public Sprite Mark { get; } public Sprite BarBackground { get; } public Sprite BarHandle { get; } public Sprite SliderTrack { get; } public Sprite SliderFill { get; } public CardSprites() { //IL_0012: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_0120: 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) Panel = Create(16f, 2.5f, UiPalette.PanelFill); Card = Create(9f, 1.5f, UiPalette.CardFill); CardHover = Create(9f, 1.5f, UiPalette.Selected); ButtonIdle = Create(10f, 1.5f, UiPalette.Idle); ButtonHover = Create(10f, 1.5f, UiPalette.Hover); ButtonSelected = Create(10f, 1.5f, UiPalette.Selected); Box = Create(8f, 1.5f, UiPalette.CardFill); Mark = Create(6f, 0f, UiPalette.Ink); BarBackground = Create(6f, 0f, UiPalette.BarBackground); BarHandle = Create(6f, 0f, UiPalette.BarHandle); SliderTrack = Create(3f, 1.5f, UiPalette.BarBackground); SliderFill = Create(3f, 1.5f, UiPalette.BarHandle); } private Sprite Create(float radius, float outline, Color fill) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_00cc: 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_00ef: 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_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) Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; Color[] array = (Color[])(object)new Color[4096]; float num = 32f; float num2 = outline * 0.6f; float edge = num - (outline + 1f) - radius; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { array[i * 64 + j] = Pixel(j, i, num, edge, radius, outline, num2, fill); } } val.SetPixels(array); val.Apply(false, true); float num3 = Mathf.Min(outline + 1f + radius + outline + num2 + 1f, 31f); Sprite obj = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(num3, num3, num3, num3)); ((Object)obj).hideFlags = (HideFlags)61; return obj; } private Color Pixel(int x, int y, float half, float edge, float radius, float outline, float inner, Color fill) { //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_00cb: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_007f: 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_00a0: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) Color val = Color.clear; Vector2 val2 = default(Vector2); for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { ((Vector2)(ref val2))..ctor(Mathf.Abs((float)x + ((float)j + 0.5f) / 4f - half) - edge, Mathf.Abs((float)y + ((float)i + 0.5f) / 4f - half) - edge); Vector2 val3 = new Vector2(Mathf.Max(val2.x, 0f), Mathf.Max(val2.y, 0f)); float distance = ((Vector2)(ref val3)).magnitude + Mathf.Min(Mathf.Max(val2.x, val2.y), 0f) - radius; val += Sample(distance, outline, inner, fill); } } return val / 16f; } private Color Sample(float distance, float outline, float inner, Color fill) { //IL_0005: 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_001b: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_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_0043: 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_0054: Unknown result type (might be due to invalid IL or missing references) if (distance < 0f - inner) { return fill; } if (distance < 0f) { if (!(outline > 0f)) { return fill; } return UiPalette.InnerHighlight; } if (distance < outline) { return UiPalette.Ink; } Color val = ((outline > 0f) ? UiPalette.Ink : fill); return new Color(val.r, val.g, val.b, 0f); } } public sealed class CloverSprite { private const int Size = 64; private const int Supersample = 4; private const float LobeReach = 17f; private const float LobeSpread = 5.2f; private const float LobeRadius = 7.3f; private const float SideWidth = 1.15f; private const float SideCurve = 0.7f; private const float HeartRadius = 3.2f; private const float StemWidth = 6f; private const float Outline = 2.5f; private const int OutlineChecks = 12; private const int StemSteps = 24; private static readonly Vector2 Middle = new Vector2(32f, 37f); private static readonly Vector2 StemBend = new Vector2(31f, 22f); private static readonly Vector2 StemEnd = new Vector2(21f, 6.5f); private static readonly Color Leaf = new Color(0.31f, 0.69f, 0.32f, 1f); private static readonly Color Stem = new Color(0.26f, 0.6f, 0.27f, 1f); private static readonly Vector2[] Leaves; private readonly Vector2[] _stem = (Vector2[])(object)new Vector2[25]; private readonly Vector2[] _ring = (Vector2[])(object)new Vector2[12]; public Sprite Sprite { get; } public CloverSprite() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_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_00db: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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) for (int i = 0; i <= 24; i++) { _stem[i] = StemPoint((float)i / 24f); } for (int j = 0; j < 12; j++) { float num = MathF.PI * 2f * (float)j / 12f; _ring[j] = new Vector2(Mathf.Cos(num), Mathf.Sin(num)) * 2.5f; } Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; Color[] array = (Color[])(object)new Color[4096]; for (int k = 0; k < 64; k++) { for (int l = 0; l < 64; l++) { Color val2 = Color.clear; for (int m = 0; m < 4; m++) { for (int n = 0; n < 4; n++) { val2 += Sample(new Vector2((float)l + ((float)n + 0.5f) / 4f, (float)k + ((float)m + 0.5f) / 4f)); } } array[k * 64 + l] = val2 / 16f; } } val.SetPixels(array); val.Apply(false, true); Sprite = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f)); ((Object)Sprite).hideFlags = (HideFlags)61; } private Color Sample(Vector2 point) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0054: 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_0024: 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_004e: 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) if (InLeaf(point)) { if (!NearEdge(point, InLeaf)) { return Leaf; } return UiPalette.Ink; } if (OnStem(point)) { if (!NearEdge(point, OnStem)) { return Stem; } return UiPalette.Ink; } return Color.clear; } private bool NearEdge(Vector2 point, Func<Vector2, bool> inside) { //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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Vector2[] ring = _ring; foreach (Vector2 val in ring) { if (!inside(point + val)) { return true; } } return false; } private bool InLeaf(Vector2 point) { //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_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_002b: 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_0032: 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_0042: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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) Vector2 val = point - Middle; if (((Vector2)(ref val)).magnitude <= 3.2f) { return true; } Vector2[] leaves = Leaves; int num = 0; while (num < leaves.Length) { Vector2 val2 = leaves[num]; float num2 = Vector2.Dot(val, val2); float num3 = Vector2.Dot(val, new Vector2(0f - val2.y, val2.x)); Vector2 val3 = new Vector2(num2 - 17f, num3 - 5.2f); if (!(((Vector2)(ref val3)).magnitude <= 7.3f)) { val3 = new Vector2(num2 - 17f, num3 + 5.2f); if (!(((Vector2)(ref val3)).magnitude <= 7.3f)) { if (num2 >= 0f && num2 <= 17f && Mathf.Abs(num3) <= 13.595f * Mathf.Pow(num2 / 17f, 0.7f)) { return true; } num++; continue; } } return true; } return false; } private bool OnStem(Vector2 point) { //IL_0005: 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_001b: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 24; i++) { if (SegmentDistance(point, _stem[i], _stem[i + 1]) <= 3f) { return true; } } return false; } private Vector2 StemPoint(float progress) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_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) float num = 1f - progress; return num * num * Middle + 2f * num * progress * StemBend + progress * progress * StemEnd; } private float SegmentDistance(Vector2 point, Vector2 start, Vector2 end) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Vector2 val = end - start; float num = Mathf.Clamp01(Vector2.Dot(point - start, val) / ((Vector2)(ref val)).sqrMagnitude); Vector2 val2 = point - (start + val * num); return ((Vector2)(ref val2)).magnitude; } static CloverSprite() { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) Vector2[] array = new Vector2[4]; Vector2 val = new Vector2(1f, 1f); array[0] = ((Vector2)(ref val)).normalized; val = new Vector2(-1f, 1f); array[1] = ((Vector2)(ref val)).normalized; val = new Vector2(-1f, -1f); array[2] = ((Vector2)(ref val)).normalized; val = new Vector2(1f, -1f); array[3] = ((Vector2)(ref val)).normalized; Leaves = (Vector2[])(object)array; } } public sealed class ConfirmClicks { private readonly Dictionary<string, int> _armed = new Dictionary<string, int>(); public int Version { get; private set; } public bool Confirm(string action, int actor) { Version++; if (_armed.TryGetValue(action, out var value) && value == actor) { _armed.Remove(action); return true; } _armed[action] = actor; return false; } public string LabelOf(string action, int actor, string label, string confirmLabel) { if (!_armed.TryGetValue(action, out var value) || value != actor) { return label; } return confirmLabel; } } public sealed class DotSprite { private const int Size = 32; private const int Supersample = 4; private const float Center = 16f; private const float Radius = 14f; public Sprite Sprite { get; } public DotSprite() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_011d: 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) //IL_00d6: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; Color[] array = (Color[])(object)new Color[1024]; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { int num = 0; for (int k = 0; k < 4; k++) { for (int l = 0; l < 4; l++) { Vector2 val2 = new Vector2((float)j + ((float)l + 0.5f) / 4f, (float)i + ((float)k + 0.5f) / 4f) - new Vector2(16f, 16f); if (((Vector2)(ref val2)).sqrMagnitude <= 196f) { num++; } } } array[i * 32 + j] = new Color(1f, 1f, 1f, (float)num / 16f); } } val.SetPixels(array); val.Apply(false, true); Sprite = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f)); ((Object)Sprite).hideFlags = (HideFlags)61; } } public sealed class DragHandle : MonoBehaviour, IDragHandler, IEventSystemHandler { private RectTransform _target; private Canvas _canvas; public void Initialize(RectTransform target, Canvas canvas) { _target = target; _canvas = canvas; } public void OnDrag(PointerEventData eventData) { //IL_0007: 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_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) RectTransform target = _target; target.anchoredPosition += eventData.delta / _canvas.scaleFactor; } } public sealed class FaceSprites { private const int Size = 64; private const int Supersample = 4; private const float Center = 32f; private const float Radius = 28f; private const float Outline = 2.5f; private const float Stroke = 2.6f; private const float EyeRadius = 4f; private const float EyeOffsetX = 10f; private const float EyeHeight = 38f; private const float MouthRadius = 13f; private const float MouthHalfWidth = 10f; private const float SmileCenter = 30f; private const float SmileCut = 26f; private const float FrownCenter = 8f; private const float FrownCut = 14f; private const float FlatMouthHeight = 20f; private const float BrowOuter = 17f; private const float BrowInner = 5f; private const float BrowOuterHeight = 49f; private const float BrowInnerHeight = 44f; private static readonly Color Happy = new Color(0.56f, 0.8f, 0.45f, 1f); private static readonly Color Worried = new Color(0.96f, 0.72f, 0.32f, 1f); private static readonly Color Angry = new Color(0.9f, 0.36f, 0.3f, 1f); public Sprite Clean { get; } public Sprite Suspect { get; } public Sprite Cheater { get; } public FaceSprites() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) Clean = Create(PlayerStanding.Clean, Happy); Suspect = Create(PlayerStanding.Suspect, Worried); Cheater = Create(PlayerStanding.Cheater, Angry); } public Sprite Of(PlayerStanding standing) { return (Sprite)(standing switch { PlayerStanding.Cheater => Cheater, PlayerStanding.Suspect => Suspect, _ => Clean, }); } private Sprite Create(PlayerStanding standing, Color fill) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_00a0: 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_00ac: 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_0070: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; Color[] array = (Color[])(object)new Color[4096]; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { Color val2 = Color.clear; for (int k = 0; k < 4; k++) { for (int l = 0; l < 4; l++) { val2 += Sample(new Vector2((float)j + ((float)l + 0.5f) / 4f, (float)i + ((float)k + 0.5f) / 4f), standing, fill); } } array[i * 64 + j] = val2 / 16f; } } val.SetPixels(array); val.Apply(false, true); Sprite obj = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f)); ((Object)obj).hideFlags = (HideFlags)61; return obj; } private Color Sample(Vector2 point, PlayerStanding standing, Color fill) { //IL_0000: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0035: 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) Vector2 val = point - new Vector2(32f, 32f); float magnitude = ((Vector2)(ref val)).magnitude; if (magnitude > 28f) { return Color.clear; } if (magnitude > 25.5f || IsFeature(point, standing)) { return UiPalette.Ink; } return fill; } private bool IsFeature(Vector2 point, PlayerStanding standing) { //IL_0000: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0098: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_0085: Unknown result type (might be due to invalid IL or missing references) Vector2 val = point - new Vector2(22f, 38f); if (!(((Vector2)(ref val)).sqrMagnitude < 16f)) { val = point - new Vector2(42f, 38f); if (!(((Vector2)(ref val)).sqrMagnitude < 16f) && (standing != PlayerStanding.Cheater || !OnBrow(point))) { if (Mathf.Abs(point.x - 32f) > 12.6f) { return false; } switch (standing) { case PlayerStanding.Cheater: return OnArc(point, 8f, point.y > 14f); case PlayerStanding.Suspect: if (Mathf.Abs(point.y - 20f) < 1.3f) { return Mathf.Abs(point.x - 32f) < 10f; } return false; default: return OnArc(point, 30f, point.y < 26f); } } } return true; } private bool OnArc(Vector2 point, float centerHeight, bool inside) { //IL_0000: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) Vector2 val = point - new Vector2(32f, centerHeight); float magnitude = ((Vector2)(ref val)).magnitude; if (inside) { return Mathf.Abs(magnitude - 13f) < 1.3f; } return false; } private bool OnBrow(Vector2 point) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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) if (!(SegmentDistance(point, new Vector2(15f, 49f), new Vector2(27f, 44f)) < 1.3f)) { return SegmentDistance(point, new Vector2(49f, 49f), new Vector2(37f, 44f)) < 1.3f; } return true; } private float SegmentDistance(Vector2 point, Vector2 start, Vector2 end) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Vector2 val = end - start; float num = Mathf.Clamp01(Vector2.Dot(point - start, val) / ((Vector2)(ref val)).sqrMagnitude); Vector2 val2 = point - (start + val * num); return ((Vector2)(ref val2)).magnitude; } } public sealed class FeedFilter { public bool ShowNotices { get; set; } = true; public bool FollowNewest { get; set; } = true; public string Search { get; set; } = string.Empty; } public sealed class FeedOptions { private const float TextSize = 20f; private const float ToggleWidth = 200f; private const float ClearWidth = 140f; private const string NoticesLabel = "Show notices"; private const string FollowLabel = "Follow newest"; private const string ClearLabel = "Clear"; private const string SearchHint = "Search nick or text..."; private readonly FeedFilter _filter; private readonly Toggle _notices; private readonly Toggle _follow; private readonly TMP_InputField _search; public FeedOptions(UiFactory ui, Transform parent, FeedFilter filter, FindingLog findings, UnityAction changed) { //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown FeedOptions feedOptions = this; _filter = filter; RectTransform parent2 = ui.Row(parent, 10f); _notices = ui.Toggle((Transform)(object)parent2, "Show notices", 20f, filter.ShowNotices, delegate(bool value) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown feedOptions.Apply((UnityAction)delegate { filter.ShowNotices = value; }, changed); }); _follow = ui.Toggle((Transform)(object)parent2, "Follow newest", 20f, filter.FollowNewest, delegate(bool value) { filter.FollowNewest = value; }); ui.Fixed((Component)(object)_notices, 200f, 0f); ui.Fixed((Component)(object)_follow, 200f, 0f); _search = ui.Input((Transform)(object)parent2, "Search nick or text...", 20f, 0f); ((UnityEvent<string>)(object)_search.onValueChanged).AddListener((UnityAction<string>)delegate(string value) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown feedOptions.Apply((UnityAction)delegate { filter.Search = value; }, changed); }); ui.Button((Transform)(object)parent2, "Clear", 140f, 20f, (UnityAction)delegate { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown feedOptions.Apply(new UnityAction(findings.Clear), changed); }); } public void Refresh() { _notices.SetIsOnWithoutNotify(_filter.ShowNotices); _follow.SetIsOnWithoutNotify(_filter.FollowNewest); if (!_search.isFocused && _search.text != _filter.Search) { _search.SetTextWithoutNotify(_filter.Search); } } private void Apply(UnityAction change, UnityAction changed) { change.Invoke(); changed.Invoke(); } } public sealed class FindingFeed { private const int LinesPerChunk = 40; private const float FontSize = 19f; private const float FixWidth = 190f; private const float BottomSlack = 24f; private const string TimeFormat = "HH:mm:ss"; private const string Empty = "no findings yet"; private const string NothingFound = "nothing matches the search"; private const string NoParseTag = "</?noparse>"; private const string FixLabel = "Fix"; private const string ConfirmFixLabel = "Not host! Fix?"; private const string FixedLabel = "Fixed"; private const string RepeatsFormat = " ×{0} (last {1})"; private static readonly Regex NoParse = new Regex("</?noparse>", RegexOptions.IgnoreCase | RegexOptions.Compiled); private readonly List<(string Text, FindingLog.Finding Fixable)> _blocks = new List<(string, FindingLog.Finding)>(); private readonly StringBuilder _builder = new StringBuilder(); private readonly UiFactory _ui; private readonly ScrollRect _scroll; private readonly RectTransform _content; private readonly FindingCategory? _category; private readonly bool _searchable; private readonly Action<FindingLog.Finding> _fix; private (int Version, bool Notices, int Actor, string Search, bool Host) _shown = (Version: -1, Notices: false, Actor: -1, Search: null, Host: false); private FindingLog.Finding _armed; public int Actor { get; set; } public FindingFeed(UiFactory ui, Transform parent, FindingCategory? category, bool searchable, Action<FindingLog.Finding> fix) { _ui = ui; _category = category; _searchable = searchable; _fix = fix; (_scroll, _content) = ui.Scroll(parent, 0f); } public void Show(FindingLog log, FeedFilter filter) { string text = (_searchable ? filter.Search.Trim() : string.Empty); (int, bool, int, string, bool) tuple = (log.Version, filter.ShowNotices, Actor, text, PhotonNetwork.IsMasterClient); (int, bool, int, string, bool) tuple2 = tuple; (int, bool, int, string, bool) shown = _shown; if (tuple2.Item1 != shown.Item1 || tuple2.Item2 != shown.Item2 || tuple2.Item3 != shown.Item3 || !(tuple2.Item4 == shown.Item4) || tuple2.Item5 != shown.Item5) { bool num = filter.FollowNewest && AtBottom(); _shown = tuple; Rebuild(log, filter.ShowNotices, text); if (num) { _scroll.verticalNormalizedPosition = 0f; } } } private bool AtBottom() { //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_001e: 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) Rect rect = _content.rect; float height = ((Rect)(ref rect)).height; rect = _scroll.viewport.rect; float num = height - ((Rect)(ref rect)).height; if (!(num <= 24f)) { return _scroll.verticalNormalizedPosition * num <= 24f; } return true; } private void Rebuild(FindingLog log, bool notices, string search) { //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) _blocks.Clear(); _builder.Clear(); int num = 0; foreach (FindingLog.Finding finding2 in log.Findings) { if ((Actor != 0 && finding2.Actor != Actor) || (_category.HasValue && finding2.Category != _category.Value) || (finding2.Kind == FindingKind.Notice && !notices) || !Matches(finding2, search)) { continue; } num++; if (finding2.Repair != null) { Flush(); _blocks.Add((LineOf(finding2), finding2)); continue; } if (_builder.Length > 0) { _builder.Append('\n'); } _builder.Append(LineOf(finding2)); if (num % 40 == 0) { Flush(); } } Flush(); if (num == 0) { _blocks.Add((RichText.Paint((search.Length > 0) ? "nothing matches the search" : "no findings yet", UiPalette.Notice), null)); } for (int num2 = ((Transform)_content).childCount - 1; num2 >= 0; num2--) { GameObject gameObject = ((Component)((Transform)_content).GetChild(num2)).gameObject; gameObject.SetActive(false); Object.Destroy((Object)(object)gameObject); } foreach (var (text, finding) in _blocks) { if (finding == null) { _ui.Label((Transform)(object)_content, text, 19f, UiPalette.Text, rich: true); } else { AddFixRow(text, finding); } } LayoutRebuilder.ForceRebuildLayoutImmediate(_content); } private void AddFixRow(string text, FindingLog.Finding finding) { //IL_003e: 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: Expected O, but got Unknown RectTransform parent = _ui.Row((Transform)(object)_content, 10f); _ui.Flexible((Component)(object)_ui.Label((Transform)(object)parent, text, 19f, UiPalette.Text, rich: true), 1f, 0f); string text2 = (finding.Fixed ? "Fixed" : ((finding == _armed) ? "Not host! Fix?" : "Fix")); ((Selectable)_ui.Button((Transform)(object)parent, text2, 190f, 19f, (UnityAction)delegate { Press(finding); }).Button).interactable = !finding.Fixed; } private void Press(FindingLog.Finding finding) { if (!PhotonNetwork.IsMasterClient && _armed != finding) { _armed = finding; _shown = (Version: -1, Notices: false, Actor: -1, Search: null, Host: false); } else { _armed = null; _fix(finding); } } private string LineOf(FindingLog.Finding finding) { //IL_00f8: Unknown result type (might be due to invalid IL or missing references) string input = ((Actor == 0) ? (finding.Name + ": ") : string.Empty); string text = ((finding.Repeats > 1) ? string.Format(" ×{0} (last {1})", finding.Repeats, finding.LastSeen.ToString("HH:mm:ss")) : string.Empty); string text2 = (FindingKinds.IsProtection(finding.Kind) ? "<sprite=\"PeakSentinelIcons\" name=\"shield\"> " : string.Empty); return RichText.Paint("[" + finding.Time.ToString("HH:mm:ss") + "] <noparse>" + NoParse.Replace(input, string.Empty) + "</noparse>" + text2 + "<noparse>" + NoParse.Replace(finding.Text, string.Empty) + "</noparse>" + text, ColorOf(finding.Kind)); } private bool Matches(FindingLog.Finding finding, string search) { if (search.Length != 0 && finding.Name.IndexOf(search, StringComparison.OrdinalIgnoreCase) < 0) { return finding.Text.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0; } return true; } private void Flush() { if (_builder.Length != 0) { _blocks.Add((_builder.ToString(), null)); _builder.Clear(); } } private Color ColorOf(FindingKind kind) { //IL_0028: 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_002e: 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) switch (kind) { case FindingKind.Cheat: case FindingKind.Blocked: case FindingKind.Recovered: case FindingKind.Kicked: return UiPalette.Cheat; case FindingKind.Suspicious: return UiPalette.Suspicious; case FindingKind.Fix: return UiPalette.Clean; default: return UiPalette.Notice; } } } public static class GameFonts { public static TMP_FontAsset Main() { FontFallbackSwapper instance = FontFallbackSwapper.instance; if (!((Object)(object)instance != (Object)null) || !((Object)(object)instance.mainBaseFont != (Object)null)) { return TMP_Settings.defaultFontAsset; } return instance.mainBaseFont; } } public enum HintScope { Everyone, You, LogOnly, NeedsHost, NotNeeded } public sealed class HotkeyButton { private const float Width = 330f; private const float TextSize = 19f; private const string KeyFormat = "Window key: {0}"; private const string NoKey = "none"; private const string Waiting = "Press a key... (Esc cancels)"; private readonly ConfigEntry<Key> _key; private readonly TextMeshProUGUI _label; public bool Listening { get; private set; } public HotkeyButton(UiFactory ui, Transform parent, ConfigEntry<Key> key) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown _key = key; TextMeshProUGUI item = ui.Button(parent, string.Empty, 330f, 19f, new UnityAction(StartListening)).Label; _label = item; ShowKey(); } public void Capture(Keyboard keyboard) { //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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_0035: Unknown result type (might be due to invalid IL or missing references) Enumerator<KeyControl> enumerator = keyboard.allKeys.GetEnumerator(); try { while (enumerator.MoveNext()) { KeyControl current = enumerator.Current; if (current != null && ((ButtonControl)current).wasPressedThisFrame) { if ((int)current.keyCode != 60) { _key.Value = current.keyCode; } StopListening(); break; } } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } public void StopListening() { Listening = false; ShowKey(); } private void StartListening() { Listening = true; ((TMP_Text)_label).text = "Press a key... (Esc cancels)"; } private void ShowKey() { //IL_0011: 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_0023: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)_label).text = string.Format("Window key: {0}", ((int)_key.Value == 0) ? "none" : ((object)_key.Value/*cast due to .constrained prefix*/).ToString()); } } public sealed class LuckText { private const string OddsFormat = "1 in {0:F0}"; private const string ThousandFormat = "1 in {0:F1}k"; private const string MillionFormat = "1 in {0:F1}M"; private const string BillionFormat = "1 in {0:F1}B"; private const string HugeOddsFormat = "1 in {0:E1}"; private const double SuspiciousOdds = 1000.0; private const double CheatOdds = 1000000.0; private const double Thousand = 1000.0; private const double Million = 1000000.0; private const double Billion = 1000000000.0; private const double Trillion = 1000000000000.0; private static readonly Color CleanBright = new Color(0.55f, 0.92f, 0.45f, 1f); public string OneIn(double chance) { double num = ((chance <= 0.0) ? double.PositiveInfinity : (1.0 / chance)); if (num >= 1000000000000.0) { return $"1 in {num:E1}"; } if (num >= 1000000000.0) { return $"1 in {num / 1000000000.0:F1}B"; } if (num >= 1000000.0) { return $"1 in {num / 1000000.0:F1}M"; } if (num >= 1000.0) { return $"1 in {num / 1000.0:F1}k"; } return $"1 in {num:F0}"; } public Color ColorOf(double chance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (chance * 1000000.0 <= 1.0) { return UiPalette.Cheat; } if (!(chance * 1000.0 <= 1.0)) { return UiPalette.Clean; } return UiPalette.Suspicious; } public Color BrightColorOf(double chance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (chance * 1000000.0 <= 1.0) { return UiPalette.CheatBright; } if (!(chance * 1000.0 <= 1.0)) { return CleanBright; } return UiPalette.SuspiciousBright; } } public sealed class PlatformSprites { private const int Size = 32; private const int Supersample = 4; private readonly Sprite _monitor; private readonly Sprite _gamepad; private readonly Sprite _phone; public PlatformSprites() { _monitor = Draw(IsMonitor); _gamepad = Draw(IsGamepad); _phone = Draw(IsPhone); } public Sprite Of(PlatformFamily family) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 if ((int)family <= 8) { if ((int)family == 4 || (int)family == 8) { return _phone; } } else if ((int)family == 16 || (int)family == 32 || (int)family == 64) { return _gamepad; } return _monitor; } public Color TintOf(PlatformFamily family) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_001d: 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_0008: Invalid comparison between Unknown and I4 //IL_0011: 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_000d: Invalid comparison between Unknown and I4 //IL_0017: 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) if ((int)family != 16) { if ((int)family != 32) { if ((int)family == 64) { return UiPalette.Xbox; } return UiPalette.Ink; } return UiPalette.PlayStation; } return UiPalette.Switch; } private bool IsMonitor(Vector2 point) { //IL_0001: 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_0049: 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) bool num = InRoundedBox(point, 2f, 10f, 30f, 29f, 3f) && !InRoundedBox(point, 5f, 13f, 27f, 26f, 1f); bool flag = InBox(point, 13.5f, 5f, 18.5f, 10f); bool flag2 = InRoundedBox(point, 8f, 2f, 24f, 5.5f, 1.5f); return num || flag || flag2; } private bool IsGamepad(Vector2 point) { //IL_0001: 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_002e: 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_007c: 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_005a: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) bool num = InRoundedBox(point, 4f, 13f, 28f, 25f, 6f) || NearSegment(point, new Vector2(9.5f, 17f), new Vector2(7.5f, 11f), 4.25f) || NearSegment(point, new Vector2(22.5f, 17f), new Vector2(24.5f, 11f), 4.25f); bool flag = InBox(point, 6.75f, 17.75f, 13.25f, 20.25f) || InBox(point, 8.75f, 15.75f, 11.25f, 22.25f); bool flag2 = Within(point, 22f, 21.3f, 1.1f) || Within(point, 24.3f, 19f, 1.1f) || Within(point, 22f, 16.7f, 1.1f) || Within(point, 19.7f, 19f, 1.1f); if (num && !flag) { return !flag2; } return false; } private bool IsPhone(Vector2 point) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) bool num = InRoundedBox(point, 9f, 2f, 23f, 30f, 3f); bool flag = InBox(point, 11.5f, 6.5f, 20.5f, 26f); bool flag2 = Within(point, 16f, 4.25f, 1.1f); if (num && !flag) { return !flag2; } return false; } private bool InBox(Vector2 point, float left, float bottom, float right, float top) { //IL_0000: 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_0013: 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) if (point.x >= left && point.x <= right && point.y >= bottom) { return point.y <= top; } return false; } private bool InRoundedBox(Vector2 point, float left, float bottom, float right, float top, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp(point.x, left + radius, right - radius); float num2 = Mathf.Clamp(point.y, bottom + radius, top - radius); if (InBox(point, left, bottom, right, top)) { Vector2 val = point - new Vector2(num, num2); return ((Vector2)(ref val)).sqrMagnitude <= radius * radius; } return false; } private bool Within(Vector2 point, float x, float y, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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) Vector2 val = point - new Vector2(x, y); return ((Vector2)(ref val)).sqrMagnitude <= radius * radius; } private bool NearSegment(Vector2 point, Vector2 from, Vector2 to, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Vector2 val = to - from; float num = Mathf.Clamp01(Vector2.Dot(point - from, val) / ((Vector2)(ref val)).sqrMagnitude); Vector2 val2 = point - (from + val * num); return ((Vector2)(ref val2)).sqrMagnitude <= radius * radius; } private Sprite Draw(Func<Vector2, bool> inside) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_00fa: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; Color[] array = (Color[])(object)new Color[1024]; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { int num = 0; for (int k = 0; k < 4; k++) { for (int l = 0; l < 4; l++) { if (inside(new Vector2((float)j + ((float)l + 0.5f) / 4f, (float)i + ((float)k + 0.5f) / 4f))) { num++; } } } array[i * 32 + j] = new Color(1f, 1f, 1f, (float)num / 16f); } } val.SetPixels(array); val.Apply(false, true); Sprite obj = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f)); ((Object)obj).hideFlags = (HideFlags)61; return obj; } } public sealed class PlayerActions { private const string KickAction = "kick"; private const string KickLabel = "Kick"; private const string ConfirmKickLabel = "Confirm kick?"; private const string BanAction = "ban"; private const string BanLabel = "Ban"; private const string ConfirmBanLabel = "Confirm ban?"; private const string BringAction = "bring"; private const string BringLabel = "Bring to me"; private const string ConfirmBringLabel = "Confirm bring?"; private const float BringLift = 1f; private const string MuteLabel = "Mute"; private const string UnmuteLabel = "Unmute"; private const string MutedBy = "by you"; private readonly ConfirmClicks _confirm = new ConfirmClicks(); private readonly SuspicionReport _report; private readonly MuteList _mutes; private readonly BanGuard _banGuard; private readonly PlayerKicker _kicker; private readonly TrustList _trust; private readonly PlayerTeleporter _teleporter; private readonly Action _changed; public string State => $"{_confirm.Version}|{_mutes.Version}|{_trust.Version}"; public PlayerActions(SuspicionReport report, MuteList mutes, BanGuard banGuard, PlayerKicker kicker, TrustList trust, PlayerTeleporter teleporter, Action changed) { _report = report; _mutes = mutes; _banGuard = banGuard; _kicker = kicker; _trust = trust; _teleporter = teleporter; _changed = changed; } public bool IsMuted(Player player) { return _mutes.IsMuted(player); } public int DroppedFrom(Player player) { return _mutes.DroppedFrom(player); } public bool IsTrusted(Player player) { return _trust.Trusts(player); } public string MuteLabelOf(Player player) { if (!_mutes.IsMuted(player)) { return "Mute"; } return "Unmute"; } public string KickLabelOf(int actor) { return _confirm.LabelOf("kick", actor, "Kick", "Confirm kick?"); } public string BanLabelOf(int actor) { return _confirm.LabelOf("ban", actor, "Ban", "Confirm ban?"); } public string BringLabelOf(int actor) { return _confirm.LabelOf("bring", actor, "Bring to me", "Confirm bring?"); } public void SwitchMute(Player player) { if (player != null) { if (_mutes.IsMuted(player)) { _mutes.Unmute(player); _report.LogAction(player, "unmuted"); } else { _mutes.Mute(player, "by you"); _report.LogAction(player, "muted: everything they send is ignored on your side"); } _changed(); } } public void Trust(Player player) { _trust.Trust(player); _report.LogAction(player, "trusted: Sentinel does not block, undo or kick anything they do"); _changed(); } public void Distrust(Player player) { _trust.Distrust(player); _report.LogAction(player, "no longer trusted"); _changed(); } public void Kick(Player player) { if (player != null && _confirm.Confirm("kick", player.ActorNumber)) { _kicker.Kick(player); _report.LogAction(player, "kicked with the Kick button"); } _changed(); } public void Ban(Player player) { if (player != null && _confirm.Confirm("ban", player.ActorNumber)) { _banGuard.Ban(player); } _changed(); } public void Bring(Player player) { if (player != null && _confirm.Confirm("bring", player.ActorNumber)) { _teleporter.BringToMe(player, 1f); } _changed(); } public Player Find(int actor) { if (PhotonNetwork.CurrentRoom != null) { return PhotonNetwork.CurrentRoom.GetPlayer(actor, false); } return null; } } public sealed class PlayerListView { private const float NameSize = 22f; private const float LineSize = 19f; private const float ButtonSize = 19f; private const float ButtonWidth = 160f; private const float AvatarSize = 56f; private const float FaceSize = 24f; private const float PingSize = 16f; private const int GoodPing = 150; private const int BadPing = 300; private const string NoIssues = "no issues"; private const string YouLabel = " (you)"; private const string HostLabel = " [host]"; private const string NotInRoom = "not in a room"; private const string PingFormat = "ping {0} ms"; private const string NoPing = "ping —"; private const string ResyncLabel = "Resync"; private const float ResyncWidth = 120f; private const string MutedNote = " · muted"; private const string ResyncAllLabel = "Resync all"; private const float ResyncAllWidth = 160f; private const string TrustedNote = " · trusted"; private readonly StringBuilder _signature = new StringBuilder(); private readonly Dictionary<int, PlayerRow> _rowViews = new Dictionary<int, PlayerRow>(); private readonly UiFactory _ui; private readonly WindowServices _services; private readonly PlayerActions _actions; private readonly PlayerLooks _looks; private readonly PlayerProfileView _profile; private readonly GameObject _list; private readonly RectTransform _rows; private string _shownSignature; public PlayerListView(UiFactory ui, Transform parent, FeedFilter filter, WindowServices services, AvatarCache avatars, Action<FindingLog.Finding> fix) { //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown _ui = ui; _services = services; _actions = new PlayerActions(services.Report, services.Mutes, services.BanGuard, services.Kicker, services.Report.Trust, services.Teleporter, Refresh); _looks = new PlayerLooks(avatars); RectTransform parent2 = ui.Row(parent, 8f); ui.Spacer((Transform)(object)parent2); ui.Button((Transform)(object)parent2, "Resync all", 160f, 19f, (UnityAction)delegate { services.Desync.ResyncAll(); }); (ScrollRect Scroll, RectTransform Content) tuple = ui.Scroll(parent, 8f); ScrollRect item = tuple.Scroll; RectTransform item2 = tuple.Content; _list = ((Component)item).gameObject; _rows = item2; _profile = new PlayerProfileView(ui, parent, services.Findings, filter, _actions, _looks, new VoiceLevels(), fix, CloseProfile); } public void Refresh() { if (_profile.Actor != 0) { _profile.Refresh(); } else { RefreshList(); } } private void RefreshList() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) string text = ListSignature(); if (text == _shownSignature) { ShowRows(); return; } _shownSignature = text; _rowViews.Clear(); for (int num = ((Transform)_rows).childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)((Transform)_rows).GetChild(num)).gameObject); } if (!PhotonNetwork.InRoom) { _ui.Label((Transform)(object)_rows, "not in a room", 19f, UiPalette.Text, rich: false); return; } Player[] playerList = PhotonNetwork.PlayerList; foreach (Player player in playerList) { AddRow(player); } ShowRows(); } private void AddRow(Player player) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00f1: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) int actor = player.ActorNumber; Button val = _ui.RowButton((Transform)(object)_rows, (UnityAction)delegate { OpenProfile(actor); }); RectTransform val2 = _ui.Column(((Component)val).transform, 6f, new RectOffset(0, 0, 0, 0)); _ui.Flexible((Component)(object)val2, 1f, 0f); RectTransform parent = _ui.Row((Transform)(object)val2, 8f); _looks.ShowAvatar(_ui.Icon((Transform)(object)parent, _ui.Sprites.Box, 56f), player); RectTransform val3 = _ui.Column((Transform)(object)parent, 2f, new RectOffset(0, 0, 0, 0)); _ui.Flexible((Component)(object)val3, 1f, 0f); TextMeshProUGUI name = _ui.Label((Transform)(object)val3, string.Empty, 22f, UiPalette.Text, rich: false); RectTransform val4 = _ui.Row((Transform)(object)val3, 8f); Image face = _ui.Icon((Transform)(object)val4, _ui.Faces.Clean, 24f); TextMeshProUGUI val5 = _ui.Label((Transform)(object)val4, string.Empty, 19f, UiPalette.Notice, rich: false); ((TMP_Text)val5).textWrappingMode = (TextWrappingModes)0; if (_services.Presence.Runs(player)) { _ui.Icon((Transform)(object)val4, _ui.Shield, 24f); } AddPlatform((Transform)(object)val4, PlayerPlatforms.FamilyOf(player)); TextMeshProUGUI val6 = _ui.Label((Transform)(object)parent, string.Empty, 16f, UiPalette.Notice, rich: true); ((TMP_Text)val6).alignment = (TextAlignmentOptions)260; ((TMP_Text)val6).textWrappingMode = (TextWrappingModes)0; RectTransform val7 = _ui.Row((Transform)(object)val2, 8f); _ui.Spacer((Transform)(object)val7); AddButtons((Transform)(object)val7, player); TextMeshProUGUI problems = _ui.Label((Transform)(object)val2, string.Empty, 19f, UiPalette.Clean, rich: true); _rowViews[actor] = new PlayerRow(name, face, val5, problems, val6); } private void ShowRows() { //IL_00ea: 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_0106: 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_01ed: Unknown result type (might be due to invalid IL or missing references) FindingLog findings = _services.Findings; foreach (KeyValuePair<int, PlayerRow> rowView in _rowViews) { Player val = _actions.Find(rowView.Key); if (val != null) { PlayerRow value = rowView.Value; PlayerStanding standing = findings.StandingOf(rowView.Key); ((TMP_Text)value.Name).text = string.Format("{0}{1}{2} #{3}", PlayerNames.Name(val), val.IsLocal ? " (you)" : string.Empty, val.IsMasterClient ? " [host]" : string.Empty, rowView.Key); value.Face.sprite = _ui.Faces.Of(standing); var (text, color) = _looks.LifeOf(val); ((TMP_Text)value.Life).text = text; ((Graphic)value.Life).color = color; ((TMP_Text)value.Problems).text = (findings.ProblemsOf(rowView.Key) ?? "no issues") + (_actions.IsMuted(val) ? RichText.Warning(" · muted") : string.Empty) + (_actions.IsTrusted(val) ? RichText.Warning(" · trusted") : string.Empty); ((Graphic)value.Problems).color = _looks.ColorOf(standing); int? num = (val.IsLocal ? new int?(PhotonNetwork.GetPing()) : _services.Latency.PingOf(rowView.Key)); ((TMP_Text)value.Ping).text = (num.HasValue ? RichText.Paint($"ping {num.Value} ms", PingColor(num.Value)) : "ping —"); } } } private void AddPlatform(Transform status, PlatformFamily family) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if ((int)family != 0) { Color color = _ui.Platforms.TintOf(family); ((Graphic)_ui.Icon(status, _ui.Platforms.Of(family), 24f)).color = color; ((TMP_Text)_ui.Label(status, PlayerPlatforms.NameOf(family), 19f, color, rich: false)).textWrappingMode = (TextWrappingModes)0; } } private void AddButtons(Transform buttons, Player player) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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 //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown int actorNumber = player.ActorNumber; if (player.IsLocal) { _ui.Button(buttons, "Resync", 120f, 19f, (UnityAction)delegate { _services.Desync.ResyncMe(); }); return; } _ui.Button(buttons, "Resync", 120f, 19f, (UnityAction)delegate { _services.Desync.Resync(player); }); if (player.IsMasterClient) { return; } _ui.Button(buttons, _actions.MuteLabelOf(player), 160f, 19f, (UnityAction)delegate { _actions.SwitchMute(player); }); if (PhotonNetwork.IsMasterClient) { _ui.Button(buttons, _actions.BringLabelOf(actorNumber), 160f, 19f, (UnityAction)delegate { _actions.Bring(player); }); _ui.Button(buttons, _actions.KickLabelOf(actorNumber), 160f, 19f, (UnityAction)delegate { _actions.Kick(player); }); _ui.Button(buttons, _actions.BanLabelOf(actorNumber), 160f, 19f, (UnityAction)delegate { _actions.Ban(player); }); } } private Color PingColor(int ping) { //IL_0008: 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_0016: Unknown result type (might be due to invalid IL or missing references) if (ping <= 150) { return UiPalette.Clean; } if (ping > 300) { return UiPalette.Cheat; } return UiPalette.Suspicious; } private string ListSignature() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) _signature.Clear(); _signature.Append(PhotonNetwork.InRoom).Append(PhotonNetwork.IsMasterClient).Append('|') .Append(_actions.State) .Append('|') .Append(_looks.Version); if (!PhotonNetwork.InRoom) { return _signature.ToString(); } Player[] playerList = PhotonNetwork.PlayerList; foreach (Player val in playerList) { _signature.Append('|').Append(val.ActorNumber).Append(val.IsMasterClient) .Append(_services.Presence.Runs(val)) .Append(PlayerPlatforms.FamilyOf(val)); } return _signature.ToString(); } private void OpenProfile(int actor) { _list.SetActive(false); _profile.Open(actor, PlayerNames.Name(_actions.Find(actor))); } private void CloseProfile() { _profile.Close(); _shownSignature = null; _list.SetActive(true); RefreshList(); } } public sealed class PlayerLooks { private const string NoBody = "no body yet"; private const string Dead = "dead"; private const string KnockedOut = "knocked out"; private const string Alive = "alive"; private readonly AvatarCache _avatars; public int Version => _avatars.Version; public PlayerLooks(AvatarCache avatars) { _avatars = avatars; } public void ShowAvatar(Image image, Player player) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) Sprite val = _avatars.Of(player); if (!((Object)(object)val == (Object)null) && !((Object)(object)image.sprite == (Object)(object)val)) { image.sprite = val; ((Transform)((Graphic)image).rectTransform).localScale = new Vector3(1f, -1f, 1f); } } public Color ColorOf(PlayerStanding standing) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return (Color)(standing switch { PlayerStanding.Cheater => UiPalette.Cheat, PlayerStanding.Suspect => UiPalette.Suspicious, _ => UiPalette.Clean, }); } public (string Text, Color Color) LifeOf(Player player) { //IL_0015: 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_006c: 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) Character playerCharacter = PlayerHandler.GetPlayerCharacter(player); if ((Object)(object)playerCharacter == (Object)null) { return (Text: "no body yet", Color: UiPalette.Notice); } if (playerCharacter.data.dead) { return (Text: "dead", Color: UiPalette.Cheat); } if (!playerCharacter.data.passedOut && !playerCharacter.data.fullyPassedOut) { return (Text: "alive", Color: UiPalette.Clean); } return (Text: "knocked out", Color: UiPalette.Suspicious); } } public sealed class PlayerProfileView { private const float NameSize = 22f; private const float LineSize = 19f; private const float ButtonSize = 19f; private const float ButtonWidth = 160f; private const float AvatarSize = 44f; private const float FaceSize = 24f; private const string BackLabel = "< Back"; private const string LeftRoom = "left the room"; private const string NoIssues = "no issues"; private const string DroppedFormat = " · muted, {0} packets ignored"; private const string VoiceLabel = "Voice volume"; private const float VolumeWidth = 360f; private const string TrustLabel = "Trust this player: nothing they do is blocked, undone or kicked by Sentinel (findings become notices; until you leave the game)"; private readonly UiFactory _ui; private readonly FindingLog _findings; private readonly FeedFilter _filter; private readonly PlayerActions _actions; private readonly PlayerLooks _looks; private readonly VoiceLevels _voiceLevels; private readonly GameObject _root; private readonly Image _avatar; private readonly TextMeshProUGUI _name; private readonly Image _face; private readonly TextMeshProUGUI _life; private readonly TextMeshProUGUI _problems; private readonly (Button Button, TextMeshProUGUI Label) _mute; private readonly (Button Button, TextMeshProUGUI Label) _bring; private readonly (Button Button, TextMeshProUGUI Label) _kick; private readonly (Button Button, TextMeshProUGUI Label) _ban; private readonly RectTransform _voice; private readonly Slider _volume; private readonly TextMeshProUGUI _percent; private readonly Toggle _trust; private readonly FindingFeed _feed; private string _title; public int Actor { get; private set; } public PlayerProfileView(UiFactory ui, Transform parent, FindingLog findings, FeedFilter filter, PlayerActions actions, PlayerLooks looks, VoiceLevels voice, Action<FindingLog.Finding> fix, Action back) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00e2: 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_012b: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01cb: 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_0277: Unknown result type (mi