Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MurphysHostMonitor v0.12.0
MurphysHostMonitor/MurphysHostMonitor.dll
Decompiled 15 hours 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.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MurphysHostMonitor")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MurphysHostMonitor")] [assembly: AssemblyTitle("MurphysHostMonitor")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MurphysHostMonitor { public sealed class Incident { public double At; public double Loss; public int Actor; public int Item; public int StrikeNumber; public string Name = ""; public string Reason = ""; public string Source = ""; public string ItemName = ""; public bool Eligible; public bool DirectHolder; } public sealed class Assessment { public string Band = "Insufficient evidence"; public double Loss; public int Episodes; public int Items; } public sealed class Strike { public int Actor; public int Number; public double At; public double Loss; public string Name = ""; public string Reason = ""; } internal sealed class StrikeState { public double LastAt = double.NegativeInfinity; public readonly Queue<Incident> Recent = new Queue<Incident>(); public readonly List<Strike> History = new List<Strike>(); } public sealed class BehaviorModel { public const int Capacity = 2000; public readonly List<Incident> Events = new List<Incident>(); public readonly ValuableTracker Valuables = new ValuableTracker(); public double WindowSeconds = 300.0; public double EpisodeGap = 8.0; public double WatchLoss = 1000.0; public double ReviewLoss = 4000.0; public int WatchEpisodes = 3; public int ReviewEpisodes = 5; public double FirstStrikeLoss = 1000.0; public double SecondStrikeLoss = 5000.0; public const double StrikeWindowSeconds = 60.0; private readonly Dictionary<int, StrikeState> strikeStates = new Dictionary<int, StrikeState>(); public Strike Add(Incident e) { if (e == null || !Finite(e.At) || !Finite(e.Loss) || e.Loss <= 0.0 || e.Actor < 0) { return null; } Valuables.Observe(e); Events.Add(e); if (Events.Count > 2000) { Events.RemoveRange(0, Events.Count - 2000); } if (!e.Eligible || e.Actor == 0 || e.Item == 0 || e.Source == "client-report-only") { return null; } if (!strikeStates.TryGetValue(e.Actor, out var value)) { value = (strikeStates[e.Actor] = new StrikeState()); } if (e.At < value.LastAt) { return null; } value.LastAt = e.At; value.Recent.Enqueue(new Incident { At = e.At, Item = e.Item, Loss = e.Loss }); while (value.Recent.Count > 0 && e.At - value.Recent.Peek().At > 60.0) { value.Recent.Dequeue(); } if (value.History.Count >= 2) { return null; } Assessment assessment = StrikeWindow(e.Actor, e.At); double num = ((value.History.Count == 0) ? FirstStrikeLoss : Math.Max(FirstStrikeLoss, SecondStrikeLoss)); if (assessment.Items < 2 || assessment.Loss < num) { return null; } Strike strike = new Strike(); strike.Actor = e.Actor; strike.Number = value.History.Count + 1; strike.At = e.At; strike.Loss = assessment.Loss; strike.Name = e.Name; strike.Reason = "Eligible loss across " + assessment.Items + " items reached $" + assessment.Loss.ToString("N0") + " within 60s; " + e.Reason; Strike strike2 = strike; e.StrikeNumber = strike2.Number; value.History.Add(strike2); return strike2; } public Assessment StrikeWindow(int actor, double now) { Assessment assessment = new Assessment(); if (!Finite(now) || !strikeStates.TryGetValue(actor, out var value)) { return assessment; } HashSet<int> hashSet = new HashSet<int>(); foreach (Incident item in value.Recent) { if (item.At <= now && now - item.At <= 60.0) { assessment.Loss += item.Loss; hashSet.Add(item.Item); } } assessment.Items = hashSet.Count; assessment.Band = ((value.History.Count >= 2) ? "Manual review required" : ((value.History.Count == 1) ? "Monitoring flagged player" : "Collecting observations")); return assessment; } public Strike[] Strikes(int actor) { if (!strikeStates.TryGetValue(actor, out var value)) { return new Strike[0]; } return value.History.ToArray(); } public void ClearStrikes(int actor) { strikeStates.Remove(actor); } public Assessment Evaluate(int actor, double now) { Assessment assessment = new Assessment(); HashSet<int> hashSet = new HashSet<int>(); double num = double.NegativeInfinity; foreach (Incident item in from e in Events where e.Actor == actor && actor > 0 && e.Eligible && e.At <= now && now - e.At <= WindowSeconds orderby e.At select e) { assessment.Loss += item.Loss; hashSet.Add(item.Item); if (item.At - num >= EpisodeGap) { assessment.Episodes++; } num = item.At; } assessment.Items = hashSet.Count; if (assessment.Episodes >= WatchEpisodes && assessment.Items >= 2 && assessment.Loss >= WatchLoss) { assessment.Band = "Watch pattern"; } if (assessment.Episodes >= ReviewEpisodes && assessment.Items >= 3 && assessment.Loss >= ReviewLoss) { assessment.Band = "Review incidents"; } return assessment; } public static bool Finite(double v) { if (!double.IsNaN(v)) { return !double.IsInfinity(v); } return false; } public static string Clean(string value) { if (value == null) { return "Unknown"; } return new string(value.Where((char c) => !char.IsControl(c) && c != '<' && c != '>').Take(48).ToArray()); } public void Reset() { Events.Clear(); strikeStates.Clear(); Valuables.Reset(); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("murphyslavv.repo.hostmonitor", "Murphys Host Monitor", "0.21.1")] public sealed class Plugin : BaseUnityPlugin { private sealed class HeldObject { public Component Physical; public Component Value; } private enum MonitorTab { Monitor, Valuables, Activity } private sealed class Notice { public int Actor; public string Message; } private sealed class Release { public int Actor; public string Name; public double At; public bool Shared; } private sealed class DamageState { public Component Value; public Component Physical; public int Item; public int Actor; public double Before; public double Reported; public string Name = ""; public string Reason = ""; public string ItemName = ""; public bool Eligible; public bool DirectHolder; } private readonly PlayerHistory playerHistory = new PlayerHistory(); private readonly Dictionary<int, string> actorIdentities = new Dictionary<int, string>(); private readonly HashSet<int> identityConflicts = new HashSet<int>(); private readonly HashSet<string> historyNotified = new HashSet<string>(); private string historyPath; private string historyStatus = "History not loaded"; private string historySession = ""; private string historyProfile = ""; private float nextHistorySave; private float nextIdentityRead; private int historySkipped; private ConfigEntry<bool> recordHistory; private readonly HoldTracker holds = new HoldTracker(); private readonly Dictionary<int, HeldObject> heldObjects = new Dictionary<int, HeldObject>(); private static readonly Color Panel = new Color(0.035f, 0.047f, 0.065f, 1f); private static readonly Color Card = new Color(0.065f, 0.083f, 0.11f, 1f); private static readonly Color Muted = new Color(0.56f, 0.62f, 0.73f, 1f); private static readonly Color Pink = new Color(1f, 0.23f, 0.64f, 1f); private static readonly Color Blue = new Color(0.22f, 0.72f, 1f, 1f); private static readonly Color Amber = new Color(1f, 0.72f, 0.29f, 1f); private GUIStyle uiText; private GUIStyle uiSmall; private GUIStyle uiTitle; private GUIStyle uiMetric; private GUIStyle uiButton; private GUIStyle uiInput; private GUIStyle uiWindow; private GUIStyle uiRoster; private GUIStyle uiCredit; private Texture2D accentTexture; private Vector2 playerScroll; private Vector2 activityScroll; private string playerSearch = ""; private MonitorTab uiTab; private bool cursorCaptured; private CursorLockMode previousLock; private bool previousCursorVisible; private bool playerOptions; private PlayerActionRequest actionDraft; private PlayerActionRequest queuedAction; private string actionMessage = ""; private string actionAvailability = ""; private PlayerActionRequest availableTarget; private float nextActionCheck; private int actionActor; private int actionRoomGeneration; private object actionRoom; private readonly LobbyBanList lobbyBans = new LobbyBanList(); private float nextBanCheck; private string enforcementScope = ""; private readonly HashSet<int> enforcedActors = new HashSet<int>(); private Texture2D signatureTexture; private Rect signatureUv = new Rect(0f, 0f, 1f, 1f); private bool signatureAttempted; public const string Guid = "murphyslavv.repo.hostmonitor"; private static Plugin instance; private Harmony harmony; private readonly BehaviorModel model = new BehaviorModel(); private readonly Queue<Notice> notices = new Queue<Notice>(); private readonly Dictionary<int, Release> releases = new Dictionary<int, Release>(); private readonly Dictionary<int, string> roster = new Dictionary<int, string>(); private readonly Dictionary<int, string> lastBands = new Dictionary<int, string>(); private readonly HashSet<string> loggedErrors = new HashSet<string>(); private ConfigEntry<KeyboardShortcut> toggle; private ConfigEntry<bool> monitoringEnabled; private ConfigEntry<bool> allowClientObservation; private bool isHost; private string sessionKey = ""; private ConfigEntry<float> attribution; private ConfigEntry<float> enemyRadius; private ConfigEntry<float> watchLoss; private ConfigEntry<float> reviewLoss; private ConfigEntry<float> firstStrikeLoss; private ConfigEntry<float> secondStrikeLoss; private bool open; private bool active; private bool ready; private int scene = -1; private int lostIndex; private int loseIndex; private int damageInfoIndex; private float nextRoster; private float toastUntil; private string status = "Starting"; private string toast = ""; private string detail = ""; private Rect window = new Rect(40f, 40f, 560f, 390f); private int selected; private int toastActor; private bool rosterFresh; private float lastRosterUpdate = -1f; private RoundJournal roundJournal; private int roundNumber; private int endedRoundScene = -1; private string endedRoundSession = ""; private void InitializeHistory() { recordHistory = ((BaseUnityPlugin)this).Config.Bind<bool>("History", "RecordingEnabled", true, "Keep local history keyed by the game's reported Steam ID. No name-based matching. Retains 90 days/up to 5000 records."); historyPath = Path.Combine(Paths.ConfigPath, "MurphysHostMonitor", "player_history.tsv"); try { playerHistory.Load(historyPath, DateTime.UtcNow); historyStatus = "History loaded locally"; } catch (Exception ex) { historyStatus = "History unavailable; original file preserved: " + ex.Message; ((BaseUnityPlugin)this).Logger.LogWarning((object)historyStatus); } } private void BindAvatarIdentity(object avatar) { try { int num = RuntimeApi.Actor(avatar); if (identityConflicts.Contains(num) || !roster.ContainsKey(num)) { return; } string text = Convert.ToString(RuntimeApi.Read(avatar, "steamID")); if (!PlayerHistory.ValidId(text)) { return; } if (actorIdentities.TryGetValue(num, out var value) && value != text) { actorIdentities.Remove(num); identityConflicts.Add(num); historyStatus = "Identity conflict for actor " + num + "; persistent linking stopped"; return; } actorIdentities[num] = text; HistorySummary historySummary = playerHistory.Summary(text); if (active && historySummary.Strikes >= 3 && historySummary.StrikeSessions >= 2 && historyNotified.Add(text)) { Notify(BehaviorModel.Clean(RuntimeApi.Name(avatar)) + ": prior repeated damage recorded in saved history.", num); } } catch { } } private void UpdateHistoryIdentities() { if (Time.unscaledTime < nextIdentityRead) { return; } nextIdentityRead = Time.unscaledTime + 3f; try { Object[] array = Object.FindObjectsOfType(RuntimeApi.Type("PlayerAvatar")); foreach (Object obj in array) { Component val = (Component)(object)((obj is Component) ? obj : null); if (val != null && Object.op_Implicit((Object)(object)val)) { BindAvatarIdentity(val); } } } catch (Exception ex) { historyStatus = "Identity lookup unavailable: " + ex.GetBaseException().Message; } } private Strike RecordIncident(Incident e) { Strike strike = model.Add(e); roundJournal?.Observe(e, strike); if (recordHistory.Value && e.Actor > 0) { if (actorIdentities.TryGetValue(e.Actor, out var value)) { if (playerHistory.Add(value, historySession, e, DateTime.UtcNow)) { historyStatus = "New local history pending save"; } } else { historySkipped++; } } return strike; } private void SaveHistory(bool force = false) { if (historyPath == null || !playerHistory.Writable || (!force && Time.unscaledTime < nextHistorySave)) { return; } nextHistorySave = Time.unscaledTime + 10f; if (!playerHistory.Dirty) { return; } try { playerHistory.Save(historyPath, DateTime.UtcNow); historyStatus = "Local history saved"; } catch (Exception ex) { historyStatus = "History save failed; unsaved changes remain in memory: " + ex.Message; ((BaseUnityPlugin)this).Logger.LogWarning((object)historyStatus); } } private void OnApplicationQuit() { FinishRoundReview("Application closed", complete: false); SaveHistory(force: true); } private string HistorySelection() { if (!string.IsNullOrEmpty(historyProfile)) { return historyProfile; } if (selected <= 0 || !actorIdentities.TryGetValue(selected, out var value)) { return ""; } return value; } private float HistoryHeight() { string id = HistorySelection(); return string.IsNullOrEmpty(id) ? (390 + playerHistory.Profiles().Length * 76) : (470 + Math.Min(30, playerHistory.Records.Count((HistoryRecord r) => r.SteamId == id)) * 110); } private static string HistoryDate(long ticks) { if (ticks != 0L) { return new DateTime(ticks, DateTimeKind.Utc).ToLocalTime().ToString("yyyy-MM-dd HH:mm"); } return "No records"; } private void DrawHistory(float w) { //IL_0017: 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) //IL_00b2: 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_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Unknown result type (might be due to invalid IL or missing references) TintText(new Rect(16f, 12f, w, 22f), "LOCAL PLAYER HISTORY / 90 DAYS / UP TO 5000 EVENTS", Blue); Text(new Rect(16f, 46f, w, 56f), historyStatus + " / " + actorIdentities.Count + " current actors linked. " + historySkipped + " events skipped without stable ID.", uiSmall); if (Button(new Rect(16f, 110f, 195f, 30f), recordHistory.Value ? "Pause history recording" : "Resume history recording")) { recordHistory.Value = !recordHistory.Value; } if (Button(new Rect(224f, 110f, 154f, 30f), "Save history now")) { SaveHistory(force: true); } string id = HistorySelection(); if (string.IsNullOrEmpty(id)) { if (selected > 0) { Text(new Rect(16f, 230f, w, 60f), "Steam ID unavailable.", uiSmall); } else { Text(new Rect(16f, 230f, w, 45f), "Saved profiles"); } float num = 306f; HistorySummary[] array = playerHistory.Profiles(); foreach (HistorySummary historySummary in array) { if (Button(new Rect(16f, num, w, 60f), historySummary.Name + " / " + HistoryDate(historySummary.LastSeen) + "\n" + historySummary.Strikes + " recorded strikes in " + historySummary.StrikeSessions + " strike-bearing observation sessions")) { historyProfile = historySummary.SteamId; activityScroll = Vector2.zero; } num += 76f; } if (playerHistory.Profiles().Length == 0) { Text(new Rect(16f, num, w, 55f), "No saved history.", uiSmall); } return; } HistorySummary historySummary2 = playerHistory.Summary(id); TintText(new Rect(16f, 230f, w, 25f), historySummary2.Name + " / " + id, Blue, uiText); Text(new Rect(16f, 268f, w, 45f), historySummary2.Pattern); Text(new Rect(16f, 321f, w, 60f), "$" + historySummary2.HeldLoss.ToString("N0") + " verified loss while held / $" + historySummary2.Reports.ToString("N0") + " unverified reports (separate). " + historySummary2.Strikes + " recorded strikes / " + historySummary2.Sessions + " observation sessions.", uiSmall); if (Button(new Rect(16f, 392f, 170f, 30f), "All saved profiles")) { selected = 0; historyProfile = ""; activityScroll = Vector2.zero; } if (playerHistory.Writable && Button(new Rect(200f, 392f, 180f, 30f), "Delete this local history")) { playerHistory.Forget(id); SaveHistory(force: true); historyProfile = ""; } float num2 = 446f; foreach (HistoryRecord item in (from r in playerHistory.Records where r.SteamId == id orderby r.UtcTicks descending select r).Take(30)) { Fill(new Rect(16f, num2, w, 100f), Panel); TintText(new Rect(28f, num2 + 8f, w - 24f, 24f), HistoryDate(item.UtcTicks) + " / $" + item.Loss.ToString("N0") + " / " + item.Source + ((item.Strike > 0 && item.Verified && item.Eligible) ? (" / STRIKE " + item.Strike) : ""), item.Verified ? Blue : Muted); Text(new Rect(28f, num2 + 37f, w - 24f, 55f), item.Item + " / " + item.Reason, uiSmall); num2 += 110f; } } private void ObservePickup(Component physical, Component value, int grabberId) { Component grabber = RuntimeApi.Grabber(grabberId); if (Object.op_Implicit((Object)(object)grabber) && RuntimeApi.Grabbers(physical).Any((object g) => g == grabber)) { object avatar = RuntimeApi.Read(grabber, "playerAvatar"); int num = RuntimeApi.Actor(avatar); if (num > 0) { int instanceID = ((Object)value).GetInstanceID(); holds.PickUp(num, instanceID, BehaviorModel.Clean(RuntimeApi.Name(avatar)), BehaviorModel.Clean(((Object)value).name.Replace("(Clone)", "").Trim()), Time.unscaledTime); heldObjects[instanceID] = new HeldObject { Physical = physical, Value = value }; } } } private void RefreshHeldItems() { foreach (IGrouping<int, ItemHold> item in from h in holds.Active group h by h.Item) { heldObjects.TryGetValue(item.Key, out var value); string text = ((value == null || !Object.op_Implicit((Object)(object)value.Physical) || !Object.op_Implicit((Object)(object)value.Value)) ? "Item removed" : (((bool)RuntimeApi.Read(value.Physical, "dead")) ? "Item destroyed" : "")); HashSet<int> hashSet = null; if (text.Length == 0) { hashSet = new HashSet<int>(from g in RuntimeApi.Grabbers(value.Physical) select RuntimeApi.Actor(RuntimeApi.Read(g, "playerAvatar"))); } foreach (ItemHold item2 in item) { if (!roster.ContainsKey(item2.Actor)) { holds.Release(item2.Actor, item2.Item, Time.unscaledTime, "Player left"); } else if (text.Length > 0) { holds.Release(item2.Actor, item2.Item, Time.unscaledTime, text); } else if (!hashSet.Contains(item2.Actor)) { holds.Release(item2.Actor, item2.Item, Time.unscaledTime, "Release observed on refresh"); } } } HashSet<int> remaining = new HashSet<int>(holds.Active.Select((ItemHold h) => h.Item)); int[] array = heldObjects.Keys.Where((int k) => !remaining.Contains(k)).ToArray(); foreach (int key in array) { heldObjects.Remove(key); } } private static string HoldTime(double seconds) { return ((int)(Math.Max(0.0, seconds) / 60.0)).ToString("00") + ":" + ((int)Math.Max(0.0, seconds) % 60).ToString("00"); } private void DrawHolds(float w) { //IL_0011: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) TintText(new Rect(16f, 14f, w, 24f), "PICKUP TIMERS / OBSERVED VALUABLES", Blue); ItemHold[] array = (from h in holds.Active where selected == 0 || h.Actor == selected orderby h.PickedAt select h).Concat(holds.Recent.Where((ItemHold h) => selected == 0 || h.Actor == selected)).ToArray(); float num = 55f; ItemHold[] array2 = array; foreach (ItemHold itemHold in array2) { Fill(new Rect(16f, num, w, 76f), Panel); Text(new Rect(28f, num + 8f, w - 150f, 22f), itemHold.Player + " / " + itemHold.Name); TintText(new Rect(w - 106f, num + 8f, 110f, 22f), HoldTime(itemHold.Duration(Time.unscaledTime)), itemHold.Active ? Blue : Muted); Text(new Rect(28f, num + 35f, w - 24f, 34f), (itemHold.Active ? (rosterFresh ? "HOLDING" : "LAST OBSERVED HOLD / ROSTER STALE") : itemHold.EndReason) + " / Pickup observed " + HoldTime((double)Time.unscaledTime - itemHold.PickedAt) + " ago / Item " + itemHold.Item, uiSmall); num += 86f; } if (array.Length == 0) { Text(new Rect(16f, num, w, 60f), "No pickups recorded.", uiSmall); } } private void SetOpen(bool value) { //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_0055: Unknown result type (might be due to invalid IL or missing references) if (value != open) { open = value; if (!value) { CancelPlayerActions(); } if (open) { previousLock = Cursor.lockState; previousCursorVisible = Cursor.visible; cursorCaptured = true; Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } else if (cursorCaptured) { Cursor.lockState = previousLock; Cursor.visible = previousCursorVisible; cursorCaptured = false; } } } private void LateUpdate() { if (open) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } } private void EnsureUi() { //IL_0014: 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_0021: 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_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_003e: Expected O, but got Unknown //IL_0043: Expected O, but got Unknown //IL_005d: 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_0080: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Expected O, but got Unknown //IL_0196: 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) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown //IL_01e1: Expected O, but got Unknown //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Expected O, but got Unknown //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) if (uiText == null) { uiText = new GUIStyle(GUI.skin.label) { fontSize = 12, wordWrap = true, richText = false, padding = new RectOffset(0, 0, 0, 0) }; uiText.normal.textColor = new Color(0.9f, 0.93f, 0.98f); uiSmall = new GUIStyle(uiText) { fontSize = 10 }; uiSmall.normal.textColor = Muted; uiCredit = new GUIStyle(uiSmall) { alignment = (TextAnchor)2, wordWrap = false }; uiTitle = new GUIStyle(uiText) { fontSize = 16, fontStyle = (FontStyle)1 }; uiMetric = new GUIStyle(uiTitle) { fontSize = 18 }; uiButton = new GUIStyle(uiText) { alignment = (TextAnchor)4, fontSize = 10, fontStyle = (FontStyle)1 }; uiButton.normal.background = null; uiButton.hover.background = null; uiButton.active.background = null; uiButton.focused.background = null; uiInput = new GUIStyle(GUI.skin.textField) { fontSize = 12, padding = new RectOffset(6, 6, 3, 3), richText = false }; uiInput.normal.textColor = Color.white; uiRoster = new GUIStyle(uiText) { fontSize = 11, wordWrap = false, clipping = (TextClipping)1 }; uiWindow = new GUIStyle { padding = new RectOffset(0, 0, 0, 0) }; accentTexture = new Texture2D(256, 1); for (int i = 0; i < 256; i++) { accentTexture.SetPixel(i, 0, Color.Lerp(Pink, Blue, (float)i / 255f)); } accentTexture.Apply(); } } private static void Fill(Rect r, Color c) { //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_000b: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = c; GUI.DrawTexture(r, (Texture)(object)Texture2D.whiteTexture); GUI.color = color; } private void Text(Rect r, string value, GUIStyle style = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) GUI.Label(r, value, style ?? uiText); } private void TintText(Rect r, string value, Color color, GUIStyle style = null) { //IL_0013: 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_0026: 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) GUIStyle val = style ?? uiSmall; Color textColor = val.normal.textColor; val.normal.textColor = color; Text(r, value, val); val.normal.textColor = textColor; } private bool Button(Rect r, string value, bool highlighted = false) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) Fill(r, (Color)(highlighted ? new Color(0.14f, 0.24f, 0.34f) : Card)); if (((Rect)(ref r)).Contains(Event.current.mousePosition)) { Fill(r, new Color(0.2f, 0.36f, 0.48f, 0.45f)); } if (highlighted) { Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - 2f, ((Rect)(ref r)).width, 2f), Blue); } return GUI.Button(r, value, uiButton); } private void Metric(Rect r, string number, string label, Color accent) { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_009e: Unknown result type (might be due to invalid IL or missing references) Fill(r, Card); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, 2f, ((Rect)(ref r)).height), accent); TintText(new Rect(((Rect)(ref r)).x + 10f, ((Rect)(ref r)).y + 3f, ((Rect)(ref r)).width - 18f, 23f), number, accent, uiMetric); Text(new Rect(((Rect)(ref r)).x + 10f, ((Rect)(ref r)).yMax - 15f, ((Rect)(ref r)).width - 18f, 14f), label, uiSmall); } private void OnGUI() { //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) if (!open && (!active || !(Time.unscaledTime < toastUntil))) { return; } EnsureUi(); Matrix4x4 matrix = GUI.matrix; Color color = GUI.color; int depth = GUI.depth; float num = Mathf.Min(new float[3] { 1f, (float)Screen.width / 580f, (float)Screen.height / 410f }); try { GUI.color = Color.white; GUI.matrix = Matrix4x4.Scale(new Vector3(num, num, 1f)); if (open) { ((Rect)(ref window)).x = Mathf.Clamp(((Rect)(ref window)).x, 0f, Mathf.Max(0f, (float)Screen.width / num - ((Rect)(ref window)).width)); ((Rect)(ref window)).y = Mathf.Clamp(((Rect)(ref window)).y, 0f, Mathf.Max(0f, (float)Screen.height / num - ((Rect)(ref window)).height)); window = GUI.Window(976221, window, new WindowFunction(DrawMonitor), "", uiWindow); } if (active && Time.unscaledTime < toastUntil) { Rect r = default(Rect); ((Rect)(ref r))..ctor((float)Screen.width / num - 520f, 12f, 500f, 92f); GUI.depth = -100; Fill(r, Panel); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, 4f, ((Rect)(ref r)).height), Pink); TintText(new Rect(((Rect)(ref r)).x + 17f, ((Rect)(ref r)).y + 10f, 466f, 18f), "LOCAL ACTIVITY ALERT", Pink, uiSmall); Text(new Rect(((Rect)(ref r)).x + 17f, ((Rect)(ref r)).y + 34f, 466f, 52f), toast); } } finally { GUI.matrix = matrix; GUI.color = color; GUI.depth = depth; } } private Dictionary<int, string> KnownPlayers() { Dictionary<int, string> dictionary = new Dictionary<int, string>(roster); foreach (PlayerDamage player in model.Valuables.Players) { if (!dictionary.ContainsKey(player.Actor)) { dictionary[player.Actor] = player.Name; } } foreach (Incident @event in model.Events) { if (@event.Actor > 0 && !dictionary.ContainsKey(@event.Actor)) { dictionary[@event.Actor] = @event.Name; } } return dictionary; } private void DrawMonitor(int id) { //IL_0014: 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_0037: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_06bc: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_0765: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_07e0: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) //IL_080a: Unknown result type (might be due to invalid IL or missing references) //IL_080f: Unknown result type (might be due to invalid IL or missing references) //IL_0849: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_0867: Unknown result type (might be due to invalid IL or missing references) //IL_087b: Unknown result type (might be due to invalid IL or missing references) //IL_089a: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_08f6: Unknown result type (might be due to invalid IL or missing references) //IL_091f: Unknown result type (might be due to invalid IL or missing references) Fill(new Rect(0f, 0f, 560f, 390f), Panel); GUI.DrawTexture(new Rect(0f, 0f, 560f, 2f), (Texture)(object)accentTexture); DrawSignature(new Rect(8f, 4f, 230f, 34f)); Text(new Rect(340f, 3f, 212f, 14f), "created by Murphy.Dev", uiCredit); if (Button(new Rect(352f, 19f, 164f, 19f), monitoringEnabled.Value ? "Disable Monitor" : "Enable Monitor", monitoringEnabled.Value)) { SetMonitoring(!monitoringEnabled.Value); } if (Button(new Rect(526f, 19f, 26f, 19f), "X")) { SetOpen(value: false); } Dictionary<int, string> dictionary = KnownPlayers(); int num = dictionary.Keys.Sum((int p) => model.Strikes(p).Length); int num2 = dictionary.Keys.Count((int p) => model.Strikes(p).Length >= 2); Metric(new Rect(8f, 43f, 130f, 40f), roster.Count.ToString(), rosterFresh ? "CONNECTED" : "ROSTER STALE", Blue); Metric(new Rect(146f, 43f, 130f, 40f), num.ToString(), "MAP STRIKES", Pink); Metric(new Rect(284f, 43f, 130f, 40f), num2.ToString(), "MANUAL REVIEW", Amber); Metric(new Rect(422f, 43f, 130f, 40f), "$" + model.Valuables.ObservedVerifiedLoss.ToString("N0"), "VALUE LOST", Muted); Fill(new Rect(8f, 92f, 146f, 270f), Card); Text(new Rect(16f, 98f, 84f, 18f), "PLAYERS", uiSmall); if (Button(new Rect(107f, 96f, 39f, 19f), "Sync")) { nextRoster = 0f; } playerSearch = GUI.TextField(new Rect(16f, 122f, 130f, 23f), playerSearch, 48, uiInput); if (string.IsNullOrEmpty(playerSearch)) { Text(new Rect(22f, 128f, 118f, 15f), "Search...", uiSmall); } KeyValuePair<int, string>[] array = (from p in dictionary where p.Value.IndexOf(playerSearch, StringComparison.OrdinalIgnoreCase) >= 0 || p.Key.ToString() == playerSearch orderby model.Valuables.Player(p.Key)?.HeldLoss ?? 0.0 descending, model.Strikes(p.Key).Length descending, p.Value select p).ToArray(); playerScroll = GUI.BeginScrollView(new Rect(12f, 153f, 138f, 203f), playerScroll, new Rect(0f, 0f, 116f, (float)Math.Max(203, 27 + array.Length * 49))); if (Button(new Rect(3f, 0f, 110f, 21f), "All players", selected == 0)) { CancelPlayerActions(); selected = 0; historyProfile = ""; activityScroll = Vector2.zero; } float num3 = 27f; KeyValuePair<int, string>[] array2 = array; for (int num4 = 0; num4 < array2.Length; num4++) { KeyValuePair<int, string> keyValuePair = array2[num4]; int num5 = model.Strikes(keyValuePair.Key).Length; Rect val = new Rect(3f, num3, 110f, 44f); Fill(val, (Color)((selected == keyValuePair.Key) ? new Color(0.12f, 0.19f, 0.28f) : Panel)); if (GUI.Button(val, "", uiButton)) { OpenPlayerOptions(keyValuePair.Key); historyProfile = ""; activityScroll = Vector2.zero; } Fill(new Rect(3f, num3, 2f, 44f), (num5 >= 2) ? Pink : ((selected == keyValuePair.Key) ? Blue : Muted)); Text(new Rect(8f, num3 + 3f, 100f, 17f), keyValuePair.Value, uiRoster); for (int num6 = 0; num6 < 2; num6++) { Fill(new Rect((float)(8 + num6 * 12), num3 + 24f, 9f, 2f), (Color)((num6 < num5) ? ((num5 >= 2) ? Pink : Amber) : new Color(0.2f, 0.24f, 0.31f))); } Text(new Rect(34f, num3 + 19f, 78f, 15f), num5 + "/2 " + ((!rosterFresh) ? "UNKNOWN" : (roster.ContainsKey(keyValuePair.Key) ? "LIVE" : "LEFT")), uiSmall); Text(new Rect(8f, num3 + 31f, 100f, 14f), "$" + (model.Valuables.Player(keyValuePair.Key)?.HeldLoss ?? 0.0).ToString("N0"), uiSmall); num3 += 49f; } if (array.Length == 0) { Text(new Rect(6f, 36f, 106f, 48f), (dictionary.Count == 0) ? "No players." : "No matches.", uiSmall); } GUI.EndScrollView(); string value; string text = ((selected <= 0) ? "All players" : (dictionary.TryGetValue(selected, out value) ? value : ("Actor " + selected))); Text(new Rect(166f, 94f, 242f, 19f), text, uiRoster); if (selected > 0 && Button(new Rect(416f, 91f, 136f, 22f), "Player options", playerOptions)) { if (playerOptions) { CancelPlayerActions(); } else { OpenPlayerOptions(selected); } } string[] array3 = new string[3] { "Monitor", "Valuables", "Activity" }; for (int num7 = 0; num7 < array3.Length; num7++) { MonitorTab monitorTab = (MonitorTab)num7; if (Button(new Rect((float)(166 + num7 * 132), 117f, 122f, 23f), array3[num7], uiTab == monitorTab)) { CancelPlayerActions(); uiTab = monitorTab; activityScroll = Vector2.zero; } } if (playerOptions) { DrawPlayerOptions(text); } else { DrawContent(new Rect(166f, 146f, 386f, 216f)); } Fill(new Rect(8f, 369f, 544f, 1f), new Color(0.18f, 0.22f, 0.3f)); Text(new Rect(8f, 375f, 440f, 14f), (!monitoringEnabled.Value) ? "Disabled" : ((!ready) ? "Unavailable" : (active ? "Monitoring" : "Waiting for game")), uiSmall); Text(new Rect(474f, 375f, 78f, 14f), "F8 / Close", uiSmall); GUI.DragWindow(new Rect(0f, 2f, 338f, 35f)); } private void DrawContent(Rect area) { //IL_000d: 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_012a: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Expected O, but got Unknown //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Expected O, but got Unknown //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) Fill(area, Card); Incident[] array = model.Events.Where((Incident e) => selected == 0 || e.Actor == selected).Reverse().Take(80) .ToArray(); Strike[] array2 = ((selected > 0) ? model.Strikes(selected) : new Strike[0]); float w = ((Rect)(ref area)).width - 52f; float num = ((uiTab == MonitorTab.Activity) ? Math.Max(((Rect)(ref area)).height, 56f + array.Sum((Incident e) => ActivityRowHeight(e, w) + 8f)) : ((uiTab == MonitorTab.Monitor) ? ((float)(335 + array2.Length * 71)) : ((uiTab == MonitorTab.Valuables) ? ((float)(270 + ((selected <= 0) ? model.Valuables.Players.Count() : (model.Valuables.Player(selected)?.Items.Count ?? 0)) * 64)) : ((Rect)(ref area)).height))); activityScroll = GUI.BeginScrollView(area, activityScroll, new Rect(0f, 0f, ((Rect)(ref area)).width - 22f, num)); if (uiTab == MonitorTab.Monitor) { DrawLiveMonitor(w, array, array2); } else if (uiTab == MonitorTab.Valuables) { DrawValuables(w); } else if (uiTab == MonitorTab.Activity) { TintText(new Rect(16f, 12f, w, 22f), "RECENT DAMAGE", Blue); float num2 = 46f; Incident[] array3 = array; foreach (Incident incident in array3) { float num4 = Math.Max(18f, uiText.CalcHeight(new GUIContent(ActivityTitle(incident)), w - 24f)); float num5 = Math.Max(24f, uiSmall.CalcHeight(new GUIContent(ActivityDetail(incident)), w - 24f)); float num6 = ActivityRowHeight(incident, w); Fill(new Rect(16f, num2, w, num6), Panel); Text(new Rect(28f, num2 + 8f, w - 24f, num4), ActivityTitle(incident)); TintText(new Rect(28f, num2 + 12f + num4, w - 24f, num5), ActivityDetail(incident), (incident.StrikeNumber > 0) ? Pink : Muted); num2 += num6 + 8f; } if (array.Length == 0) { Text(new Rect(16f, 46f, w, 90f), "No damage recorded.", uiSmall); } } GUI.EndScrollView(); } private string ActivityTitle(Incident e) { return ((e.Actor == 0) ? "Unattributed" : (e.Name + " [" + e.Actor + "]")) + " / $" + e.Loss.ToString("N0") + " / " + Math.Max(0.0, (double)Time.unscaledTime - e.At).ToString("F0") + "s ago"; } private string ActivityDetail(Incident e) { return (string.IsNullOrEmpty(e.ItemName) ? "Valuable" : e.ItemName) + " | " + ((e.StrikeNumber > 0) ? ("STRIKE " + e.StrikeNumber + "/2 | ") : (e.Eligible ? "ELIGIBLE | " : "CONTEXT | ")) + e.Reason; } private float ActivityRowHeight(Incident e, float w) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown return 20f + Math.Max(18f, uiText.CalcHeight(new GUIContent(ActivityTitle(e)), w - 24f)) + Math.Max(24f, uiSmall.CalcHeight(new GUIContent(ActivityDetail(e)), w - 24f)); } private void DrawLiveMonitor(float w, Incident[] entries, Strike[] strikes) { //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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_06ee: Unknown result type (might be due to invalid IL or missing references) //IL_06f8: Unknown result type (might be due to invalid IL or missing references) //IL_0714: Unknown result type (might be due to invalid IL or missing references) //IL_06af: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_05ee: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Unknown result type (might be due to invalid IL or missing references) //IL_07a4: Unknown result type (might be due to invalid IL or missing references) //IL_07a9: Unknown result type (might be due to invalid IL or missing references) //IL_07cd: Unknown result type (might be due to invalid IL or missing references) //IL_082d: Unknown result type (might be due to invalid IL or missing references) //IL_0852: Unknown result type (might be due to invalid IL or missing references) bool flag = monitoringEnabled.Value && active; Color val = ((flag && rosterFresh) ? Blue : Amber); Fill(new Rect(16f, 12f, 5f, 5f), val); TintText(new Rect(29f, 5f, w - 10f, 18f), (!monitoringEnabled.Value) ? "DISABLED" : (flag ? "SESSION TELEMETRY" : "WAITING FOR GAME"), val); string text = ((lastRosterUpdate < 0f) ? "No roster snapshot" : ("Roster " + Math.Max(0f, Time.unscaledTime - lastRosterUpdate).ToString("F1") + "s ago")); Text(new Rect(16f, 25f, w, 16f), text + " / " + (rosterFresh ? "CURRENT" : "STALE / CONNECTIONS UNKNOWN"), uiSmall); Rect r = default(Rect); for (int i = 0; i < 2; i++) { float num = (w - 8f) / 2f; ((Rect)(ref r))..ctor(16f + (float)i * (num + 8f), 44f, num, 22f); Fill(r, Panel); TintText(new Rect(((Rect)(ref r)).x + 8f, ((Rect)(ref r)).y + 4f, num - 16f, 16f), "S" + (i + 1) + " $" + ((i == 0) ? model.FirstStrikeLoss : Math.Max(model.FirstStrikeLoss, model.SecondStrikeLoss)).ToString("N0") + ((selected > 0 && i < strikes.Length) ? " / RECORDED" : " / --"), (selected > 0 && i < strikes.Length) ? Pink : Muted); } TintText(new Rect(16f, 76f, w, 16f), "DAMAGE / LAST 60 SECONDS", Blue); double[] array = new double[30]; double num2 = Time.unscaledTime; foreach (Incident @event in model.Events) { double num3 = num2 - @event.At; if ((selected == 0 || @event.Actor == selected) && num3 >= 0.0 && num3 < 60.0 && @event.Source != "client-report-only") { array[29 - (int)(num3 / 2.0)] += @event.Loss; } } double num4 = Math.Max(1.0, array.Max()); Fill(new Rect(16f, 96f, w, 24f), Panel); for (int j = 0; j < array.Length; j++) { float num5 = (float)(array[j] / num4 * 20.0); Fill(new Rect(20f + (float)j * ((w - 8f) / 30f), 116f - num5, (w - 8f) / 30f - 3f, Math.Max(2f, num5)), (Color)((array[j] > 0.0) ? Blue : new Color(0.14f, 0.18f, 0.23f))); } Text(new Rect(16f, 123f, w, 16f), "60s ago / Verified loss per 2s / Now", uiSmall); TintText(new Rect(16f, 147f, w, 16f), "RECENT DAMAGE", Blue); float num6 = 170f; foreach (Incident item in entries.Take(1)) { Color val2 = ((item.StrikeNumber > 0) ? Pink : ((item.Source == "client-report-only") ? Amber : Blue)); Fill(new Rect(16f, num6, w, 35f), Panel); Fill(new Rect(16f, num6, 2f, 35f), val2); Text(new Rect(24f, num6 + 6f, 37f, 18f), Math.Max(0.0, num2 - item.At).ToString("F0") + "s", uiSmall); Text(new Rect(58f, num6 + 2f, w - 177f, 16f), (item.Actor == 0) ? "Unattributed" : item.Name, uiRoster); Text(new Rect(58f, num6 + 19f, w - 177f, 15f), string.IsNullOrEmpty(item.ItemName) ? "Valuable" : item.ItemName, uiSmall); TintText(new Rect(w - 103f, num6 + 2f, 112f, 16f), "-$" + item.Loss.ToString("N0"), val2); Text(new Rect(w - 103f, num6 + 19f, 112f, 15f), (item.StrikeNumber > 0) ? ("STRIKE " + item.StrikeNumber + "/2") : ((item.Source == "client-report-only") ? "UNVERIFIED" : (item.Eligible ? "ELIGIBLE" : "CONTEXT")), uiSmall); num6 += 47f; } if (entries.Length == 0) { Text(new Rect(16f, 173f, w, 30f), "No damage recorded.", uiSmall); } Assessment assessment = model.StrikeWindow(selected, Time.unscaledTime); TintText(new Rect(16f, 238f, w, 18f), "PLAYER REVIEW", Blue); Text(new Rect(16f, 264f, w, 42f), (selected == 0) ? "All players" : (assessment.Band + " / $" + assessment.Loss.ToString("N0") + " / " + assessment.Items + " items in 60s")); num6 = 316f; foreach (Strike strike in strikes) { Fill(new Rect(16f, num6, w, 61f), Panel); TintText(new Rect(25f, num6 + 5f, w - 18f, 18f), "STRIKE " + strike.Number + "/2 / " + Math.Max(0.0, num2 - strike.At).ToString("F0") + "s ago", Pink); Text(new Rect(25f, num6 + 26f, w - 18f, 32f), strike.Reason, uiSmall); num6 += 71f; } } private void DrawValuables(float w) { //IL_00c1: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) ValuableTracker valuables = model.Valuables; PlayerDamage playerDamage = valuables.Player(selected); PlayerDamage[] array = valuables.Players.ToArray(); double num = ((selected <= 0) ? array.Sum((PlayerDamage p) => p.HeldLoss) : (playerDamage?.HeldLoss ?? 0.0)); double num2 = ((selected <= 0) ? array.Sum((PlayerDamage p) => p.UnverifiedReports) : (playerDamage?.UnverifiedReports ?? 0.0)); TintText(new Rect(16f, 12f, w, 24f), "VALUABLE DAMAGE / CURRENT MAP", Blue); float num3 = (w - 12f) / 2f; Metric(new Rect(16f, 42f, num3, 66f), "$" + num.ToString("N0"), "HELD LOSS", Pink); Metric(new Rect(28f + num3, 42f, num3, 66f), "$" + num2.ToString("N0"), "UNVERIFIED", Muted); if (selected > 0) { Text(new Rect(16f, 122f, w, 43f), (playerDamage?.Hits ?? 0) + " damage events / " + (playerDamage?.Items.Count ?? 0) + " damaged objects. Tentative release loss: $" + (playerDamage?.TentativeLoss ?? 0.0).ToString("N0"), uiSmall); Text(new Rect(16f, 160f, w, 42f), (playerDamage == null || playerDamage.Hits == 0) ? "No damage recorded." : ("Latest: -$" + playerDamage.LastLoss.ToString("N0") + " / " + playerDamage.LastItem + " / " + Math.Max(0.0, (double)Time.unscaledTime - playerDamage.LastAt).ToString("F0") + "s ago")); float num4 = 210f; { foreach (ItemDamage item in (playerDamage?.Items.Values.AsEnumerable() ?? Enumerable.Empty<ItemDamage>()).OrderByDescending((ItemDamage i) => i.Loss)) { Fill(new Rect(16f, num4, w, 54f), Panel); Text(new Rect(28f, num4 + 8f, w - 24f, 24f), item.Name + " [" + item.Item + "] / -$" + item.Loss.ToString("N0")); Text(new Rect(28f, num4 + 32f, w - 24f, 20f), item.Hits + " verified damage events", uiSmall); num4 += 64f; } return; } } Text(new Rect(16f, 122f, w, 58f), "Unassigned verified loss: $" + valuables.UnassignedVerifiedLoss.ToString("N0"), uiSmall); float num5 = 166f; foreach (PlayerDamage item2 in array.OrderByDescending((PlayerDamage p) => p.HeldLoss)) { Fill(new Rect(16f, num5, w, 54f), Panel); Text(new Rect(28f, num5 + 8f, w - 24f, 24f), item2.Name + " [" + item2.Actor + "] / -$" + item2.HeldLoss.ToString("N0")); Text(new Rect(28f, num5 + 32f, w - 24f, 20f), item2.Items.Count + " damaged objects / " + item2.Hits + " events / $" + item2.UnverifiedReports.ToString("N0") + " unverified reports", uiSmall); num5 += 64f; } if (array.Length == 0) { Text(new Rect(16f, num5, w, 40f), "No damage recorded.", uiSmall); } } private void ResetPlayerStrikes() { model.ClearStrikes(selected); Notice[] array = notices.Where((Notice n) => n.Actor != selected).ToArray(); notices.Clear(); Notice[] array2 = array; foreach (Notice item in array2) { notices.Enqueue(item); } if (toastActor == selected) { toastUntil = 0f; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Local viewer reset strikes for actor " + selected)); } private string ActionSession() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) string[] obj = new string[5] { RuntimeApi.SessionKey(), ":", actionRoomGeneration.ToString(), ":", null }; Scene activeScene = SceneManager.GetActiveScene(); obj[4] = ((object)((Scene)(ref activeScene)).handle/*cast due to .constrained prefix*/).ToString(); return string.Concat(obj); } private void MaintainLobbyBans() { object obj = RuntimeApi.Read(RuntimeApi.Type("Photon.Pun.PhotonNetwork"), "CurrentRoom"); if (obj != actionRoom) { actionRoom = obj; actionRoomGeneration++; } bool num = RuntimeApi.Host(); string text = (num ? (RuntimeApi.SessionKey() + ":" + actionRoomGeneration) : ""); lobbyBans.SetScope(text); if (text != enforcementScope) { enforcementScope = text; enforcedActors.Clear(); } if (!num || Time.unscaledTime < nextBanCheck) { return; } nextBanCheck = Time.unscaledTime + 1f; foreach (object item in RuntimeApi.Players()) { if (Convert.ToBoolean(RuntimeApi.Read(item, "IsLocal"))) { continue; } int num2 = Convert.ToInt32(RuntimeApi.Read(item, "ActorNumber")); PlayerModerationBridge playerModerationBridge = new PlayerModerationBridge(); if (enforcedActors.Contains(num2)) { continue; } string id = playerModerationBridge.Identity(num2); if (lobbyBans.ShouldRemove(id, num2) || playerModerationBridge.PermanentlyBlocked(id)) { PlayerActionRequest playerActionRequest = CurrentTarget(num2, PlayerAction.LobbyBan); string text2 = playerModerationBridge.Execute(playerActionRequest); if (text2 == playerActionRequest.Name + ": lobby ban sent.") { lobbyBans.MarkSent(num2); enforcedActors.Add(num2); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Lobby ban rejoin: " + text2)); } } } private void CancelPlayerActions() { playerOptions = false; actionDraft = null; queuedAction = null; availableTarget = null; actionActor = 0; nextActionCheck = 0f; actionMessage = ""; } private void OpenPlayerOptions(int actor) { CancelPlayerActions(); selected = actor; playerOptions = actor > 0; } private PlayerActionRequest CurrentTarget(int actor, PlayerAction action) { if (!RuntimeApi.Host()) { throw new InvalidOperationException("Only the current host can remove players."); } PlayerModerationBridge playerModerationBridge = new PlayerModerationBridge(); object obj = RuntimeApi.Players().FirstOrDefault((object p) => Convert.ToInt32(RuntimeApi.Read(p, "ActorNumber")) == actor); if (obj == null) { throw new InvalidOperationException("That player has left."); } string steamId = playerModerationBridge.Identity(actor); PlayerActionRequest playerActionRequest = new PlayerActionRequest(actor, steamId, ActionSession(), BehaviorModel.Clean(Convert.ToString(RuntimeApi.Read(obj, "NickName"))), action); string text = PlayerActionPolicy.Validate(playerActionRequest, RuntimeApi.Host(), ActionSession(), actor, steamId, Convert.ToBoolean(RuntimeApi.Read(obj, "IsLocal"))) ?? playerModerationBridge.TargetReason(actor); if (text != null) { throw new InvalidOperationException(text); } return playerActionRequest; } private void TickPlayerActions() { try { MaintainLobbyBans(); } catch (Exception ex) { actionAvailability = ex.GetBaseException().Message; } if (queuedAction != null) { PlayerActionRequest playerActionRequest = queuedAction; queuedAction = null; actionDraft = null; try { if (!open || !playerOptions || selected != playerActionRequest.Actor) { return; } PlayerActionRequest playerActionRequest2 = CurrentTarget(playerActionRequest.Actor, playerActionRequest.Action); string text = PlayerActionPolicy.Validate(playerActionRequest, RuntimeApi.Host(), playerActionRequest2.Session, playerActionRequest2.Actor, playerActionRequest2.SteamId, local: false); if (text != null) { throw new InvalidOperationException(text); } actionMessage = new PlayerModerationBridge().Execute(playerActionRequest); if (playerActionRequest.Action == PlayerAction.LobbyBan && actionMessage == playerActionRequest.Name + ": lobby ban sent.") { lobbyBans.Add(playerActionRequest.SteamId); lobbyBans.MarkSent(playerActionRequest.Actor); } ((BaseUnityPlugin)this).Logger.LogInfo((object)actionMessage); nextRoster = 0f; } catch (Exception ex2) { actionMessage = ex2.GetBaseException().Message; ((BaseUnityPlugin)this).Logger.LogWarning((object)("Player action: " + actionMessage)); } nextActionCheck = 0f; } if (!open || !playerOptions || (actionActor == selected && Time.unscaledTime < nextActionCheck)) { return; } actionActor = selected; nextActionCheck = Time.unscaledTime + 0.5f; availableTarget = null; try { availableTarget = CurrentTarget(selected, PlayerAction.Kick); actionAvailability = ""; } catch (Exception ex3) { actionAvailability = ex3.GetBaseException().Message; } } private void DraftPlayerAction(PlayerAction action) { if (availableTarget != null) { actionDraft = new PlayerActionRequest(availableTarget.Actor, availableTarget.SteamId, availableTarget.Session, availableTarget.Name, action); actionMessage = ""; } } private void DrawPlayerOptions(string name) { //IL_0014: 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_0038: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) Fill(new Rect(166f, 146f, 386f, 216f), Card); Text(new Rect(180f, 155f, 354f, 20f), (actionDraft == null) ? "PLAYER OPTIONS" : "CONFIRM REMOVAL", uiSmall); if (actionDraft != null) { Text(new Rect(180f, 181f, 354f, 20f), actionDraft.Name, uiRoster); Text(new Rect(180f, 204f, 354f, 18f), "Steam ID: " + actionDraft.SteamId, uiSmall); Text(new Rect(180f, 230f, 354f, 48f), (actionDraft.Action == PlayerAction.Kick) ? "Kick this player? They can rejoin." : ((actionDraft.Action == PlayerAction.LobbyBan) ? "Ban this player from the current lobby?" : "Permanently block this player from your hosted lobbies until unblocked?"), uiText); if (Button(new Rect(180f, 289f, 173f, 27f), "Confirm " + ((actionDraft.Action == PlayerAction.Kick) ? "kick" : ((actionDraft.Action == PlayerAction.LobbyBan) ? "lobby ban" : "permanent ban")), highlighted: true)) { queuedAction = actionDraft; actionDraft = null; } if (Button(new Rect(363f, 289f, 173f, 27f), "Cancel")) { actionDraft = null; queuedAction = null; } return; } bool enabled = GUI.enabled; GUI.enabled = enabled && availableTarget != null && queuedAction == null; if (Button(new Rect(180f, 181f, 173f, 27f), "Kick")) { DraftPlayerAction(PlayerAction.Kick); } if (Button(new Rect(363f, 181f, 173f, 27f), "Ban this lobby")) { DraftPlayerAction(PlayerAction.LobbyBan); } if (Button(new Rect(180f, 218f, 356f, 27f), "Permanent ban")) { DraftPlayerAction(PlayerAction.PermanentBan); } GUI.enabled = enabled; if (Button(new Rect(180f, 255f, 173f, 25f), "Reset strikes")) { ResetPlayerStrikes(); } if (Button(new Rect(363f, 255f, 173f, 25f), "Close options")) { CancelPlayerActions(); } Text(new Rect(180f, 291f, 354f, 62f), (!string.IsNullOrEmpty(actionMessage)) ? actionMessage : ((availableTarget != null) ? "" : (string.IsNullOrEmpty(actionAvailability) ? "Checking player..." : actionAvailability)), uiSmall); } private void EnsureSignature() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) if (signatureAttempted) { return; } signatureAttempted = true; try { using (Stream stream = typeof(Plugin).Assembly.GetManifestResourceStream("MurphysHostMonitor.Signature.png")) { using MemoryStream memoryStream = new MemoryStream(); if (stream == null) { throw new InvalidDataException("Signature resource missing"); } stream.CopyTo(memoryStream); signatureTexture = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(signatureTexture, memoryStream.ToArray(), false)) { throw new InvalidDataException("Signature image could not be decoded"); } } Color32[] pixels = signatureTexture.GetPixels32(); int num = ((Texture)signatureTexture).width; int num2 = ((Texture)signatureTexture).height; int num3 = -1; int num4 = -1; for (int i = 0; i < ((Texture)signatureTexture).height; i++) { for (int j = 0; j < ((Texture)signatureTexture).width; j++) { if (pixels[i * ((Texture)signatureTexture).width + j].a > 4) { num = Math.Min(num, j); num3 = Math.Max(num3, j); num2 = Math.Min(num2, i); num4 = Math.Max(num4, i); } } } if (num3 >= num && num4 >= num2) { signatureUv = new Rect((float)num / (float)((Texture)signatureTexture).width, (float)num2 / (float)((Texture)signatureTexture).height, ((float)(num3 - num) + 1f) / (float)((Texture)signatureTexture).width, ((float)(num4 - num2) + 1f) / (float)((Texture)signatureTexture).height); } ((Texture)signatureTexture).wrapMode = (TextureWrapMode)1; ((Texture)signatureTexture).filterMode = (FilterMode)1; signatureTexture.Apply(false, true); } catch (Exception ex) { ReleaseSignature(); ((BaseUnityPlugin)this).Logger.LogWarning((object)("Menu signature unavailable: " + ex.GetBaseException().Message)); } } private void DrawSignature(Rect bounds) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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) EnsureSignature(); if (!Object.op_Implicit((Object)(object)signatureTexture)) { Text(bounds, "MurphysLavv", uiTitle); return; } float num = (float)((Texture)signatureTexture).width * ((Rect)(ref signatureUv)).width / ((float)((Texture)signatureTexture).height * ((Rect)(ref signatureUv)).height); float num2 = Mathf.Min(((Rect)(ref bounds)).width, ((Rect)(ref bounds)).height * num); float num3 = num2 / num; GUI.DrawTextureWithTexCoords(new Rect(((Rect)(ref bounds)).x, ((Rect)(ref bounds)).y + (((Rect)(ref bounds)).height - num3) / 2f, num2, num3), (Texture)(object)signatureTexture, signatureUv, true); } private void ReleaseSignature() { if (Object.op_Implicit((Object)(object)signatureTexture)) { Object.Destroy((Object)(object)signatureTexture); } signatureTexture = null; } private void Awake() { //IL_0069: 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_00b6: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Expected O, but got Unknown //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Expected O, but got Unknown instance = this; InitializeHistory(); monitoringEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Observe locally available gameplay and show local warnings. Strikes never enforce punishments; removal requires explicit host confirmation."); allowClientObservation = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "AllowClientObservation", true, "Enable local observation as a nonhost. Other players do not need this plugin; client coverage may be incomplete."); toggle = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Display", "ToggleKey", new KeyboardShortcut((KeyCode)289, Array.Empty<KeyCode>()), "Open monitor panel."); attribution = ((BaseUnityPlugin)this).Config.Bind<float>("Tracking", "ReleaseSeconds", 2f, new ConfigDescription("Recent-release evidence only; never contributes to warnings.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>())); enemyRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Tracking", "EnemyContextRadius", 12f, new ConfigDescription("Exclude losses from pattern warnings when a loaded enemy is this close.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 50f), Array.Empty<object>())); watchLoss = ((BaseUnityPlugin)this).Config.Bind<float>("Patterns", "WatchLoss", 1000f, new ConfigDescription("Minimum loss in five minutes, plus three episodes across two objects.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 1000000f), Array.Empty<object>())); reviewLoss = ((BaseUnityPlugin)this).Config.Bind<float>("Patterns", "ReviewLoss", 4000f, new ConfigDescription("Minimum loss in five minutes, plus five episodes across three objects.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 1000000f), Array.Empty<object>())); firstStrikeLoss = ((BaseUnityPlugin)this).Config.Bind<float>("Strikes", "FirstStrike60sLoss", 1000f, new ConfigDescription("First strike: eligible loss across at least two distinct items within 60 seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 1000000f), Array.Empty<object>())); secondStrikeLoss = ((BaseUnityPlugin)this).Config.Bind<float>("Strikes", "SecondStrike60sLoss", 5000f, new ConfigDescription("Second strike: cumulative eligible loss across at least two items within 60 seconds, followed by manual review. No automatic third strike.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 1000000f), Array.Empty<object>())); model.FirstStrikeLoss = firstStrikeLoss.Value; model.SecondStrikeLoss = secondStrikeLoss.Value; harmony = new Harmony("murphyslavv.repo.hostmonitor"); try { MethodInfo method = RuntimeApi.Type("SemiFunc").GetMethod("RunIsLevel", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); if (method == null || method.ReturnType != typeof(bool)) { throw new MissingMethodException("SemiFunc.RunIsLevel"); } RuntimeApi.Host(); RuntimeApi.Type("Enemy"); if (AccessTools.Field(RuntimeApi.Type("PhysGrabObject"), "playerGrabbing") == null || AccessTools.Field(RuntimeApi.Type("ValuableObject"), "dollarValueCurrent") == null) { throw new MissingMemberException("Required value/grabber fields unavailable"); } MethodInfo methodInfo = RuntimeApi.Unique("PhysGrabObject", "GrabPlayerAddRPC", typeof(int)); MethodInfo methodInfo2 = RuntimeApi.Unique("PhysGrabObject", "GrabPlayerRemoveRPC", typeof(int)); MethodInfo[] array = (from m in RuntimeApi.Type("PhysGrabObjectImpactDetector").GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) where m.Name == "BreakRPC" && m.ReturnType == typeof(void) && m.GetParameters().Any((ParameterInfo p) => p.Name == "valueLost" && p.ParameterType == typeof(float)) && m.GetParameters().Any((ParameterInfo p) => p.Name == "_loseValue" && p.ParameterType == typeof(bool)) select m).ToArray(); if (array.Length != 1) { throw new MissingMethodException("BreakRPC signature unavailable or ambiguous"); } MethodInfo methodInfo3 = array[0]; lostIndex = Array.FindIndex(methodInfo3.GetParameters(), (ParameterInfo p) => p.Name == "valueLost"); loseIndex = Array.FindIndex(methodInfo3.GetParameters(), (ParameterInfo p) => p.Name == "_loseValue"); damageInfoIndex = Array.FindIndex(methodInfo3.GetParameters(), (ParameterInfo p) => p.ParameterType.FullName == "Photon.Pun.PhotonMessageInfo"); if (damageInfoIndex < 0 || methodInfo.GetParameters().Last().ParameterType.FullName != "Photon.Pun.PhotonMessageInfo" || methodInfo2.GetParameters().Last().ParameterType.FullName != "Photon.Pun.PhotonMessageInfo") { throw new MissingMethodException("Expected current RPC sender metadata signatures"); } harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, Hook("GrabAdded"), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)methodInfo2, Hook("GrabRemoved"), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)methodInfo3, Hook("BeforeDamage"), Hook("AfterDamage"), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ready = true; status = "Ready; waiting for gameplay"; } catch (Exception ex) { ready = false; status = "Monitoring unavailable: " + ex.GetBaseException().Message; ((BaseUnityPlugin)this).Logger.LogWarning((object)status); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Murphys Host Monitor 0.21.1 loaded. F8 opens the panel."); } private static HarmonyMethod Hook(string name) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown return new HarmonyMethod(typeof(Plugin).GetMethod(name, BindingFlags.Static | BindingFlags.NonPublic)); } private bool CanObserve() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) try { int result; if (active && ObservationPolicy.Allows(ready, monitoringEnabled.Value, RuntimeApi.InRoom(), RuntimeApi.Level(), RuntimeApi.Host(), allowClientObservation.Value) && RuntimeApi.SessionKey() == sessionKey) { Scene activeScene = SceneManager.GetActiveScene(); result = ((((Scene)(ref activeScene)).handle == SceneHandle.op_Implicit(scene)) ? 1 : 0); } else { result = 0; } return (byte)result != 0; } catch (Exception e) { Error(e); return false; } } private void Error(Exception e) { detail = "Observation unavailable: " + e.GetBaseException().Message; if (loggedErrors.Count < 30 && loggedErrors.Add(detail)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)detail); } } private void ResetData() { CancelPlayerActions(); FinishRoundReview("Observation reset, paused, disconnected, or scene changed", complete: false); actorIdentities.Clear(); identityConflicts.Clear(); nextIdentityRead = 0f; rosterFresh = false; lastRosterUpdate = -1f; nextRoster = 0f; model.Reset(); holds.Reset(); heldObjects.Clear(); notices.Clear(); releases.Clear(); roster.Clear(); lastBands.Clear(); toast = ""; toastUntil = 0f; selected = 0; detail = ""; } private void Update() { //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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = toggle.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { SetOpen(!open); } SaveHistory(); TickPlayerActions(); try { Scene activeScene = SceneManager.GetActiveScene(); int num = SceneHandle.op_Implicit(((Scene)(ref activeScene)).handle); bool flag = RuntimeApi.InRoom(); isHost = RuntimeApi.Host(); string text = RuntimeApi.SessionKey(); bool flag2 = ObservationPolicy.Allows(ready, monitoringEnabled.Value, flag, flag && ready && RuntimeApi.Level(), isHost, allowClientObservation.Value); if (num == scene && text == sessionKey) { PollRoundEnd(); } if (num != scene || flag2 != active || text != sessionKey) { if (text != sessionKey) { historySession = System.Guid.NewGuid().ToString("N"); historyNotified.Clear(); } ResetData(); scene = num; active = flag2; sessionKey = text; nextRoster = 0f; } BeginRoundReview(scene, sessionKey); PollRoundEnd(); status = ((!ready) ? status : ((!monitoringEnabled.Value) ? "Monitor disabled" : ((!active) ? ((!flag) ? "Inactive: join a game to observe" : ((!isHost && !allowClientObservation.Value) ? "Client observation disabled in config" : "Waiting for a playable level")) : (isHost ? "Observing as host (local alerts)" : "Observing as nonhost (local alerts; partial coverage)")))); model.FirstStrikeLoss = firstStrikeLoss.Value; model.SecondStrikeLoss = Math.Max(firstStrikeLoss.Value, secondStrikeLoss.Value); if (active && notices.Count > 0 && Time.unscaledTime >= toastUntil) { Notice notice = notices.Dequeue(); toast = notice.Message; toastActor = notice.Actor; toastUntil = Time.unscaledTime + 8f; } model.WatchLoss = watchLoss.Value; model.ReviewLoss = Math.Max(watchLoss.Value, reviewLoss.Value); if (!flag) { roster.Clear(); rosterFresh = true; lastRosterUpdate = Time.unscaledTime; } else { if (Time.unscaledTime < nextRoster) { return; } nextRoster = Time.unscaledTime + 1f; try { RosterSync.Apply(roster, from p in RuntimeApi.Players() select new KeyValuePair<int, string>(Convert.ToInt32(RuntimeApi.Read(p, "ActorNumber")), Convert.ToString(RuntimeApi.Read(p, "NickName")))); rosterFresh = true; lastRosterUpdate = Time.unscaledTime; } catch (Exception e) { rosterFresh = false; Error(e); return; } RefreshHeldItems(); UpdateHistoryIdentities(); CaptureRoundPlayers(); if (!active) { return; } int[] array = (from p in releases where (double)Time.unscaledTime - p.Value.At > (double)attribution.Value select p.Key).ToArray(); foreach (int key in array) { releases.Remove(key); } { foreach (KeyValuePair<int, string> item in roster) { Assessment assessment = model.Evaluate(item.Key, Time.unscaledTime); lastBands.TryGetValue(item.Key, out var value2); if (model.Strikes(item.Key).Length != 0 && BandRank(assessment.Band) > BandRank(value2)) { Notify(item.Value + ": " + assessment.Band + " | " + assessment.Episodes + " episodes, $" + assessment.Loss.ToString("N0") + " loss. Review context (F8).", item.Key); } lastBands[item.Key] = assessment.Band; } return; } } } catch (Exception e2) { active = false; ResetData(); Error(e2); status = "Monitoring unavailable; see game log"; } } private static void GrabAdded(Component __instance, object[] __args) { if ((Object)(object)instance == (Object)null || !instance.CanObserve()) { return; } try { if (RuntimeApi.AcceptedMasterRpc(__args[^1])) { Component val = RuntimeApi.Get(__instance, "ValuableObject"); if (Object.op_Implicit((Object)(object)val)) { instance.releases.Remove(((Object)val).GetInstanceID()); instance.ObservePickup(__instance, val, Convert.ToInt32(__args[0])); } } } catch (Exception e) { instance.Error(e); } } private static void GrabRemoved(Component __instance, object[] __args) { if ((Object)(object)instance == (Object)null || !instance.CanObserve()) { return; } try { if (!RuntimeApi.AcceptedMasterRpc(__args[^1])) { return; } Component val = RuntimeApi.Get(__instance, "ValuableObject"); if (!Object.op_Implicit((Object)(object)val)) { return; } Component grabber = RuntimeApi.Grabber(Convert.ToInt32(__args[0])); if (Object.op_Implicit((Object)(object)grabber)) { object avatar = RuntimeApi.Read(grabber, "playerAvatar"); List<object> list = RuntimeApi.Grabbers(__instance); if (list.Any((object g) => g == grabber)) { instance.holds.Release(RuntimeApi.Actor(avatar), ((Object)val).GetInstanceID(), Time.unscaledTime, "Released"); instance.releases[((Object)val).GetInstanceID()] = new Release { Actor = RuntimeApi.Actor(avatar), Name = RuntimeApi.Name(avatar), At = Time.unscaledTime, Shared = (list.Count != 1) }; } } } catch (Exception e) { instance.Error(e); } } private static void BeforeDamage(Component __instance, object[] __args, out DamageState __state) { //IL_0239: Unknown result type (might be due to invalid IL or missing references) __state = null; if ((Object)(object)instance == (Object)null || !instance.CanObserve()) { return; } try { if (!RuntimeApi.AcceptedMasterRpc(__args[instance.damageInfoIndex])) { instance.detail = "Ignored damage RPC rejected by native sender validation"; } else { if (!(bool)__args[instance.loseIndex]) { return; } double num = Convert.ToDouble(__args[instance.lostIndex]); if (!BehaviorModel.Finite(num) || num <= 0.0) { return; } Component val = RuntimeApi.Get(__instance, "ValuableObject"); if (!Object.op_Implicit((Object)(object)val)) { return; } DamageState damageState = new DamageState { Value = val, Item = ((Object)val).GetInstanceID(), ItemName = BehaviorModel.Clean(((Object)val).name.Replace("(Clone)", "").Trim()), Reported = num, Before = Convert.ToDouble(RuntimeApi.Read(val, "dollarValueCurrent")), Reason = "Environment / unknown handler" }; Component val2 = RuntimeApi.Get(val, "PhysGrabObject"); if (!Object.op_Implicit((Object)(object)val2) || (bool)RuntimeApi.Read(val2, "dead")) { return; } damageState.Physical = val2; List<object> list = RuntimeApi.Grabbers(val2); Release value; if (list.Count == 1) { object avatar = RuntimeApi.Read(list[0], "playerAvatar"); damageState.Actor = RuntimeApi.Actor(avatar); damageState.Name = RuntimeApi.Name(avatar); instance.BindAvatarIdentity(avatar); damageState.DirectHolder = damageState.Actor > 0; damageState.Eligible = damageState.DirectHolder; damageState.Reason = "Loss while sole holder (cause unproven)"; } else if (list.Count > 1) { damageState.Reason = "Shared carry: no individual attribution"; } else if (instance.releases.TryGetValue(damageState.Item, out value) && (double)Time.unscaledTime - value.At <= (double)instance.attribution.Value && !value.Shared) { damageState.Actor = value.Actor; damageState.Name = value.Name; damageState.Reason = "Recent release: tentative handler; excluded from warnings"; } if (damageState.Eligible) { try { if (RuntimeApi.EnemyNearby(val.transform.position, instance.enemyRadius.Value)) { damageState.Eligible = false; damageState.Reason += "; nearby enemy, excluded from warnings"; } } catch (Exception e) { damageState.Eligible = false; damageState.Reason += "; enemy context unavailable, excluded"; instance.Error(e); } } __state = damageState; } } catch (Exception e2) { instance.Error(e2); } } private static void AfterDamage(DamageState __state) { if (__state == null || (Object)(object)instance == (Object)null || !instance.CanObserve()) { return; } try { if (!Object.op_Implicit((Object)(object)__state.Value)) { instance.detail = "Damage callback destroyed an item before value verification; event skipped"; return; } double after = Convert.ToDouble(RuntimeApi.Read(__state.Value, "dollarValueCurrent")); bool flag = Object.op_Implicit((Object)(object)__state.Physical) && (bool)RuntimeApi.Read(__state.Physical, "dead"); double num = VerifiedLoss.Calculate(__state.Before, after, __state.Reported, flag); if (flag && num > 0.0) { __state.Reason += "; destruction observed, full pre-hit value counted"; } if (!BehaviorModel.Finite(num) || num <= 0.0) { if (!instance.isHost) { instance.RecordIncident(new Incident { At = Time.unscaledTime, Actor = Math.Max(0, __state.Actor), Name = __state.Name, Item = __state.Item, ItemName = __state.ItemName, Loss = __state.Reported, Eligible = false, DirectHolder = __state.DirectHolder, Source = "client-report-only", Reason = "Received damage report; local loss unverified; excluded from strikes. " + __state.Reason }); instance.detail = "Client report observed; no local decrease verified. Context only, no strike."; } else { instance.detail = "Damage callback seen; no immediate value decrease verified. Event skipped."; } return; } Strike strike = instance.RecordIncident(new Incident { At = Time.unscaledTime, Actor = Math.Max(0, __state.Actor), Name = __state.Name, Item = __state.Item, ItemName = __state.ItemName, DirectHolder = __state.DirectHolder, Loss = num, Eligible = __state.Eligible, Reason = __state.Reason, Source = (instance.isHost ? "host-verified" : "client-verified") }); if (strike != null) { instance.Notify(strike.Name + " [" + strike.Actor + "] STRIKE " + strike.Number + "/2: $" + strike.Loss.ToString("N0") + " eligible valuable loss." + ((strike.Number == 2) ? " MANUAL REVIEW REQUIRED (F8)." : " Player flagged for monitoring (F8)."), strike.Actor); } instance.detail = "Last verified event: $" + num.ToString("N0") + " | " + __state.Reason; } catch (Exception e) { instance.Error(e); } } private void Notify(string message, int actor = 0) { notices.Enqueue(new Notice { Actor = actor, Message = message }); ((BaseUnityPlugin)this).Logger.LogInfo((object)message); } private void SetMonitoring(bool value) { if (monitoringEnabled.Value != value) { if (!value) { SaveHistory(force: true); } monitoringEnabled.Value = value; if (!value) { active = false; ResetData(); status = "Monitor disabled"; } nextRoster = 0f; } } private static int BandRank(string band) { if (!(band == "Review incidents")) { return (band == "Watch pattern") ? 1 : 0; } return 2; } private void OnDestroy() { active = false; SaveHistory(force: true); SetOpen(value: false); if (Object.op_Implicit((Object)(object)accentTexture)) { Object.Destroy((Object)(object)accentTexture); } ReleaseSignature(); if (harmony != null) { harmony.UnpatchSelf(); } if (instance == this) { instance = null; } } private void BeginRoundReview(int currentScene, string currentSession) { if (active && roundJournal == null && (endedRoundScene != currentScene || !(endedRoundSession == currentSession))) { roundJournal = new RoundJournal(++roundNumber, System.Guid.NewGuid().ToString("N"), currentSession, Time.unscaledTime, DateTime.UtcNow, isHost); } } private void CaptureRoundPlayers() { if (roundJournal == null) { return; } foreach (KeyValuePair<int, string> item in roster) { actorIdentities.TryGetValue(item.Key, out var value); roundJournal.Player(item.Key, item.Value, identityConflicts.Contains(item.Key) ? "" : value); } } private void PollRoundEnd() { if (roundJournal == null || !active) { return; } try { object obj = RuntimeApi.Read(RuntimeApi.Type("GameDirector"), "instance"); Component val = (Component)((obj is Component) ? obj : null); if (val == null || Object.op_Implicit((Object)(object)val)) { string text = Convert.ToString(RuntimeApi.Read(obj, "currentState")); switch (text) { case "Result": case "End": case "EndWait": endedRoundScene = scene; endedRoundSession = sessionKey; FinishRoundReview("Native round phase: " + text, complete: true); break; } } } catch (Exception ex) { string text2 = "Round-end detection unavailable: " + ex.GetBaseException().Message; if (loggedErrors.Count < 30 && loggedErrors.Add(text2)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)text2); } } } private void FinishRoundReview(string reason, bool complete) { if (roundJournal == null) { return; } CaptureRoundPlayers(); RoundJournal obj = roundJournal; roundJournal = null; RoundReport roundReport = obj.Finish(Time.unscaledTime, DateTime.UtcNow, reason, complete, holds); try { string text = Path.Combine(Paths.ConfigPath, "MurphysHostMonitor", "RoundReviews"); Directory.CreateDirectory(text); string text2 = Path.Combine(text, "Round_" + roundReport.Number + "_" + roundReport.Id + ".txt"); File.WriteAllText(text2, roundReport.Text); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Round report saved: " + text2)); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Round report save failed: " + ex.Message)); } } } public sealed class ItemHold { public int Actor; public int Item; public string Player = ""; public string Name = ""; public string EndReason = ""; public double PickedAt; public double EndedAt; public bool Active; public double Duration(double now) { return Math.Max(0.0, (Active ? now : EndedAt) - PickedAt); } } public sealed class HoldSummary { public int Actor; public int Pickups; public int Completed; public string Player = ""; public double Seconds; public double Longest; } public sealed class HoldTracker { private readonly Dictionary<Tuple<int, int>, ItemHold> active = new Dictionary<Tuple<int, int>, ItemHold>(); private readonly Diction