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 ShiftReport v1.0.4
BepInEx/plugins/ShiftReport/ShiftReport.dll
Decompiled an hour ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Makir")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("End-of-level shift report for R.E.P.O.")] [assembly: AssemblyFileVersion("1.0.4.0")] [assembly: AssemblyInformationalVersion("1.0.4")] [assembly: AssemblyProduct("ShiftReport")] [assembly: AssemblyTitle("ShiftReport")] [assembly: AssemblyVersion("1.0.4.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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 ShiftReport { internal sealed class PlayerStats { public int Actor; public string Id = string.Empty; public string Name = string.Empty; public float CarrySeconds; public int KillPoints; public int Kills; public float Energy; public float WeaponEnergy; public float DroneEnergy; public float OtherEnergy; public readonly List<float> PointSamples = new List<float>(256); public readonly List<float> EnergySamples = new List<float>(256); public int CarryPoints => Mathf.FloorToInt(CarrySeconds); public int Points => CarryPoints + KillPoints; public void PadSamples(int count) { while (PointSamples.Count < count) { PointSamples.Add(0f); } while (EnergySamples.Count < count) { EnergySamples.Add(0f); } if (PointSamples.Count > count) { PointSamples.RemoveRange(count, PointSamples.Count - count); } if (EnergySamples.Count > count) { EnergySamples.RemoveRange(count, EnergySamples.Count - count); } } } internal sealed class LevelResult { public int Day = 1; public float Duration = 1f; public bool Victory = true; public bool Remote; public int Revision; public readonly List<PlayerStats> Players = new List<PlayerStats>(8); public int TotalPoints { get; private set; } public int TotalKills { get; private set; } public float TotalEnergy { get; private set; } public float UnattributedEnergy { get; set; } public void Recalculate() { TotalPoints = 0; TotalKills = 0; TotalEnergy = 0f; int num = 0; for (int i = 0; i < Players.Count; i++) { PlayerStats playerStats = Players[i]; TotalPoints += playerStats.Points; TotalKills += playerStats.Kills; TotalEnergy += playerStats.Energy; if (playerStats.PointSamples.Count > num) { num = playerStats.PointSamples.Count; } if (playerStats.EnergySamples.Count > num) { num = playerStats.EnergySamples.Count; } } for (int j = 0; j < Players.Count; j++) { Players[j].PadSamples(num); } Players.Sort(delegate(PlayerStats a, PlayerStats b) { int num2 = b.Points.CompareTo(a.Points); return (num2 != 0) ? num2 : b.Energy.CompareTo(a.Energy); }); } } internal sealed class NetSync { public const byte EventCode = 201; private readonly Plugin _plugin; private readonly object _gate = new object(); private LevelResult? _pending; private bool _subscribed; public NetSync(Plugin plugin) { _plugin = plugin; } public void EnsureSubscribed() { if (_subscribed) { return; } try { if (PhotonNetwork.NetworkingClient != null) { PhotonNetwork.NetworkingClient.EventReceived += OnEvent; _subscribed = true; } } catch (Exception ex) { _plugin.Log.LogWarning((object)("Shift Report: could not subscribe to Photon events: " + ex.Message)); } } public void Unsubscribe() { if (!_subscribed) { return; } try { if (PhotonNetwork.NetworkingClient != null) { PhotonNetwork.NetworkingClient.EventReceived -= OnEvent; } } catch { } _subscribed = false; } public void Send(LevelResult result) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (!_plugin.SyncEnabled || !GameManager.Multiplayer() || !PhotonNetwork.InRoom || !PhotonNetwork.IsMasterClient) { return; } try { byte[] array = SnapshotCodec.Encode(result); RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent((byte)201, (object)array, val, SendOptions.SendReliable); _plugin.Log.LogInfo((object)$"Shift Report: sent result ({array.Length} bytes, {result.Players.Count} players)"); } catch (Exception ex) { _plugin.Log.LogWarning((object)("Shift Report: result broadcast failed: " + ex.Message)); } } public LevelResult? TakePending() { lock (_gate) { LevelResult? pending = _pending; _pending = null; return pending; } } private void OnEvent(EventData photonEvent) { if (photonEvent.Code != 201 || !(photonEvent.CustomData is byte[] bytes) || (PhotonNetwork.LocalPlayer != null && photonEvent.Sender == PhotonNetwork.LocalPlayer.ActorNumber)) { return; } if (!SnapshotCodec.TryDecode(bytes, out LevelResult result) || result == null) { _plugin.Log.LogWarning((object)"Shift Report: received a malformed result snapshot"); return; } lock (_gate) { _pending = result; } } } [HarmonyPatch(typeof(PhysGrabObject), "GrabPlayerAddRPC")] internal static class GrabAddedPatch { private static void Postfix(PhysGrabObject __instance, int photonViewID) { Safe.Run("grab", delegate { Plugin.Instance?.Tracker.RecordGrab(__instance, photonViewID); }); } } [HarmonyPatch(typeof(ItemBattery), "Start")] internal static class BatteryStartPatch { private static void Postfix(ItemBattery __instance) { Safe.Run("battery.start", delegate { Plugin.Instance?.Tracker.RegisterBattery(__instance); }); } } [HarmonyPatch(typeof(ItemToggle), "ToggleItemRPC")] internal static class ItemTogglePatch { private static void Postfix(ItemToggle __instance) { Safe.Run("item.toggle", delegate { Plugin.Instance?.Tracker.RecordToggle(__instance); }); } } [HarmonyPatch(typeof(HurtCollider), "EnemyHurt")] internal static class EnemyHurtPatch { private static void Prefix(HurtCollider __instance, Enemy _enemy) { Safe.Run("enemy.hurt", delegate { Plugin.Instance?.Tracker.RecordEnemyHit(__instance, _enemy); }); } } [HarmonyPatch(typeof(EnemyHealth), "DeathRPC")] internal static class EnemyDeathPatch { private static void Postfix(EnemyHealth __instance) { Safe.Run("enemy.death", delegate { Plugin.Instance?.Tracker.RecordEnemyDeath(__instance); }); } } [HarmonyPatch(typeof(EnemyHealth), "DeathImpulseRPC")] internal static class EnemyDeathImpulsePatch { private static void Postfix(EnemyHealth __instance) { Safe.Run("enemy.death.impulse", delegate { Plugin.Instance?.Tracker.RecordEnemyDeath(__instance); }); } } [HarmonyPatch(typeof(GameDirector), "OutroStart")] internal static class OutroStartPatch { private static void Postfix() { Safe.Run("outro.start", delegate { Plugin.Instance?.Tracker.TryFinalizeFromOutro(); }); } } [BepInPlugin("makir.repo.shiftreport", "Shift Report", "1.0.4")] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "makir.repo.shiftreport"; public const string PluginName = "Shift Report"; public const string PluginVersion = "1.0.4"; private Harmony? _harmony; private ConfigEntry<KeyboardShortcut> _readyKey; private ConfigEntry<float> _readyHoldSeconds; private ConfigEntry<KeyboardShortcut> _forceEndKey; private ConfigEntry<string> _language; private ConfigEntry<float> _carryRate; private ConfigEntry<int> _killBase; private ConfigEntry<float> _killPerHealth; private ConfigEntry<bool> _trackEnergy; private ConfigEntry<bool> _syncResults; private ConfigEntry<bool> _logSummary; private bool _wasInLevel; private bool _visible; private bool _frozen; private float _previousTimeScale = 1f; public static Plugin? Instance { get; private set; } public ManualLogSource Log => ((BaseUnityPlugin)this).Logger; internal StatsTracker Tracker { get; private set; } internal NetSync Network { get; private set; } internal ReadySync Ready { get; private set; } internal ReportUI UI { get; private set; } public float CarryPointsPerSecond => _carryRate.Value; public int KillBasePoints => _killBase.Value; public float KillPerHealth => _killPerHealth.Value; public bool TrackEnergy => _trackEnergy.Value; public bool SyncEnabled => _syncResults.Value; public KeyCode ReadyKey { get { //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_000e: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = _readyKey.Value; return ((KeyboardShortcut)(ref value)).MainKey; } } public float ReadyHoldSeconds => _readyHoldSeconds.Value; public bool UseRussian { get { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Invalid comparison between Unknown and I4 //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 string text = _language.Value ?? "Russian"; if (text.Equals("Russian", StringComparison.OrdinalIgnoreCase) || text.Equals("Русский", StringComparison.OrdinalIgnoreCase)) { return true; } if (text.Equals("English", StringComparison.OrdinalIgnoreCase)) { return false; } if ((int)Application.systemLanguage != 30 && (int)Application.systemLanguage != 38) { return (int)Application.systemLanguage == 3; } return true; } } private void Awake() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Expected O, but got Unknown Instance = this; _readyKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Ready", "ReadyKey", new KeyboardShortcut((KeyCode)32, Array.Empty<KeyCode>()), "Hold this key to confirm you are ready at the end of a shift."); _readyHoldSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Ready", "HoldSeconds", 2f, new ConfigDescription("How long the ready key must be held.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 5f), Array.Empty<object>())); _forceEndKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Debug", "ForceEndKey", new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>()), "Optional developer key that ends the current level to preview the end-of-level report."); _language = ((BaseUnityPlugin)this).Config.Bind<string>("Display", "Language", "Russian", "UI language: Russian, English, or Auto."); _carryRate = ((BaseUnityPlugin)this).Config.Bind<float>("Scoring", "CarryPointsPerSecond", 1f, new ConfigDescription("Points per second of holding or pulling a valuable.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>())); _killBase = ((BaseUnityPlugin)this).Config.Bind<int>("Scoring", "KillBasePoints", 10, new ConfigDescription("Base points for a kill before health/type scaling.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 200), Array.Empty<object>())); _killPerHealth = ((BaseUnityPlugin)this).Config.Bind<float>("Scoring", "KillPointsPerHealth", 1.5f, new ConfigDescription("Extra points per point of enemy max health.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); _trackEnergy = ((BaseUnityPlugin)this).Config.Bind<bool>("Scoring", "TrackEnergy", true, "Track battery/energy spent by weapons, drones and other equipment."); _syncResults = ((BaseUnityPlugin)this).Config.Bind<bool>("Network", "SyncResults", true, "Host broadcasts the final result so every player sees the same report."); _logSummary = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "LogSummary", true, "Write a one-line result summary to the BepInEx log."); Tracker = new StatsTracker(this); Network = new NetSync(this); Ready = new ReadySync(this); UI = new ReportUI(this); _harmony = new Harmony("makir.repo.shiftreport"); ApplyPatches(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Shift Report 1.0.4 loaded (R.E.P.O. " + Application.version + ", end-of-level report)")); if (HasCommandLineArg("-shiftreport-selftest")) { RunSelfTest(); } } private void ApplyPatches() { int num = 0; int num2 = 0; Type[] types = typeof(Plugin).Assembly.GetTypes(); foreach (Type type in types) { if (type.IsDefined(typeof(HarmonyPatch), inherit: true)) { try { _harmony.CreateClassProcessor(type).Patch(); num++; } catch (Exception ex) { num2++; ((BaseUnityPlugin)this).Logger.LogWarning((object)("Shift Report: patch " + type.Name + " failed: " + ex.GetType().Name + ": " + ex.Message)); } } } if (num2 == 0) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Shift Report: {num} patch classes applied"); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)$"Shift Report: {num} patch classes applied, {num2} failed"); } } private void RunSelfTest() { try { LevelResult levelResult = TestData.Build(); byte[] array = SnapshotCodec.Encode(levelResult); if (!SnapshotCodec.TryDecode(array, out LevelResult result) || result == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Shift Report self-test: snapshot round-trip failed"); } else { ((BaseUnityPlugin)this).Logger.LogInfo((object)($"Shift Report self-test: {array.Length} bytes, " + $"points {levelResult.TotalPoints}->{result.TotalPoints}, " + $"energy {levelResult.TotalEnergy:0.0}->{result.TotalEnergy:0.0}, " + $"players {levelResult.Players.Count}->{result.Players.Count}")); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Shift Report self-test: " + ex)); } } private static bool HasCommandLineArg(string value) { string[] commandLineArgs = Environment.GetCommandLineArgs(); for (int i = 0; i < commandLineArgs.Length; i++) { if (string.Equals(commandLineArgs[i], value, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } private void Update() { try { UpdateCore(); } catch (Exception e) { Safe.Report("update", e); } } private void UpdateCore() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_002b: Unknown result type (might be due to invalid IL or missing references) Network.EnsureSubscribed(); KeyboardShortcut value = _forceEndKey.Value; if ((int)((KeyboardShortcut)(ref value)).MainKey != 0) { value = _forceEndKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { ForceEndLevel(); } } bool flag = SafeRunIsLevel(); if (flag && !_wasInLevel) { Tracker.BeginLevel(); Ready.Reset(); UnfreezeGame(); _visible = false; } if (flag) { Tracker.Update(); } if (!flag && _wasInLevel) { Tracker.HandleLevelExit(); } _wasInLevel = flag; LevelResult levelResult = Network.TakePending(); if (levelResult != null) { Tracker.ApplyRemote(levelResult); } if (_visible) { Ready.Update(); } } private void ForceEndLevel() { if (SafeRunIsLevel() && !((Object)(object)RunManager.instance == (Object)null)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Shift Report: developer force-end requested"); RunManager.instance.ChangeLevel(true, false, (ChangeLevelType)0); } } internal void OnResultReady(LevelResult result) { bool num = !_visible; _visible = true; UI.BeginReveal(); Ready.Begin(result.Players.Count); FreezeGame(); if (num) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Shift Report: report opened for {result.Players.Count} player(s), waiting for ready"); if (_logSummary.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Shift Report: {result.TotalPoints} points, {result.TotalKills} kills, {result.TotalEnergy:0.0} energy, {result.Duration:0}s"); } } } internal void OnAllReady() { if (_visible) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Shift Report: all players ready, resuming level flow"); Ready.Reset(); _visible = false; UnfreezeGame(); } } private void FreezeGame() { if (!_frozen) { _previousTimeScale = Time.timeScale; Time.timeScale = 0f; _frozen = true; Cursor.lockState = (CursorLockMode)0; Cursor.visible = false; HideNativeCursor(); } } private void UnfreezeGame() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (!_frozen) { return; } Time.timeScale = ((_previousTimeScale > 0f) ? _previousTimeScale : 1f); _frozen = false; Cursor.lockState = (CursorLockMode)0; Cursor.visible = false; try { if ((Object)(object)MenuCursor.instance != (Object)null) { GameObject val = Ref.Get<GameObject>(Ref.MenuCursorMesh, MenuCursor.instance); if ((Object)(object)val != (Object)null) { val.SetActive(false); } ((Component)MenuCursor.instance).transform.localScale = Vector3.zero; } } catch { } } private void HideNativeCursor() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)MenuCursor.instance == (Object)null)) { GameObject val = Ref.Get<GameObject>(Ref.MenuCursorMesh, MenuCursor.instance); if ((Object)(object)val != (Object)null) { val.SetActive(false); } ((Component)MenuCursor.instance).transform.localScale = Vector3.zero; } } catch (Exception e) { Safe.Report("cursor", e); } } private void OnGUI() { try { LevelResult result = Tracker.Result; if (_visible && result != null) { UI.Draw(result); } } catch (Exception e) { Safe.Report("gui", e); } } private void OnDestroy() { Ready?.Unsubscribe(); Network?.Unsubscribe(); try { Harmony? harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch { } UnfreezeGame(); UI?.Dispose(); Instance = null; } private static bool SafeRunIsLevel() { try { return SemiFunc.RunIsLevel(); } catch { return false; } } } internal sealed class ReadySync { private const byte ReadyRequestCode = 202; private const byte ReadyStateCode = 203; private const byte AllReadyCode = 204; private readonly Plugin _plugin; private readonly HashSet<int> _ready = new HashSet<int>(); private bool _subscribed; private bool _active; private bool _localReady; private bool _allReady; private int _expected = 1; private float _hold; private float _holdDuration = 2f; public int ReadyCount => _ready.Count; public int Expected => Mathf.Max(1, _expected); public bool LocalReady => _localReady; public bool AllReady => _allReady; public float HoldProgress => Mathf.Clamp01(_hold / Mathf.Max(0.1f, _holdDuration)); private static bool IsMultiplayer { get { if (GameManager.Multiplayer()) { return PhotonNetwork.InRoom; } return false; } } private static bool IsHost { get { if (GameManager.Multiplayer()) { return PhotonNetwork.IsMasterClient; } return true; } } private static int LocalActor { get { if (PhotonNetwork.LocalPlayer == null) { return 1; } return PhotonNetwork.LocalPlayer.ActorNumber; } } public ReadySync(Plugin plugin) { _plugin = plugin; } public void Begin(int expected) { expected = Mathf.Max(1, expected); if (!_active || _expected != expected) { _active = true; _expected = expected; _holdDuration = Mathf.Max(0.2f, _plugin.ReadyHoldSeconds); _ready.Clear(); _localReady = false; _allReady = false; _hold = 0f; if (IsHost && IsMultiplayer) { BroadcastState(); } } } public void Reset() { _active = false; _ready.Clear(); _localReady = false; _allReady = false; _hold = 0f; } public void Update() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) EnsureSubscribed(); if (!_active || _allReady || _localReady) { return; } if (Input.GetKey(_plugin.ReadyKey)) { _hold += Time.unscaledDeltaTime; if (_hold >= _holdDuration) { MarkLocalReady(); } } else { _hold = 0f; } } private void MarkLocalReady() { if (_active && !_localReady) { _localReady = true; _hold = _holdDuration; int localActor = LocalActor; if (!IsMultiplayer) { AddReady(1); return; } if (IsHost) { AddReady(localActor); return; } _ready.Add(localActor); Raise(202, new byte[2] { 1, (byte)localActor }, (ReceiverGroup)2); } } private void AddReady(int actor) { if (_active && _ready.Add(actor)) { if (_ready.Count >= Expected) { Complete(); } else if (IsHost && IsMultiplayer) { BroadcastState(); } } } private void Complete() { if (!_allReady) { _allReady = true; if (IsMultiplayer) { Raise(204, new byte[1] { 3 }, (ReceiverGroup)1); } _plugin.OnAllReady(); } } private void BroadcastState() { if (!IsMultiplayer) { return; } int count = _ready.Count; byte[] array = new byte[3 + count]; array[0] = 2; array[1] = (byte)Expected; array[2] = (byte)count; int num = 3; foreach (int item in _ready) { array[num++] = (byte)item; } Raise(203, array, (ReceiverGroup)1); } private void ApplyState(byte[] payload) { if (payload.Length >= 3 && payload[0] == 2) { _expected = Mathf.Max(1, (int)payload[1]); int num = payload[2]; _ready.Clear(); for (int i = 0; i < num && 3 + i < payload.Length; i++) { _ready.Add(payload[3 + i]); } } } private void OnEvent(EventData photonEvent) { if (!_active || !(photonEvent.CustomData is byte[] array) || array.Length == 0) { return; } switch (photonEvent.Code) { case 202: if (IsHost && array[0] == 1 && array.Length >= 2) { AddReady(array[1]); } break; case 203: if (!IsHost) { ApplyState(array); } break; case 204: if (!_allReady) { _allReady = true; _plugin.OnAllReady(); } break; } } public void EnsureSubscribed() { if (_subscribed) { return; } try { if (PhotonNetwork.NetworkingClient != null) { PhotonNetwork.NetworkingClient.EventReceived += OnEvent; _subscribed = true; } } catch (Exception ex) { _plugin.Log.LogWarning((object)("Shift Report: ready sync subscribe failed: " + ex.Message)); } } public void Unsubscribe() { if (!_subscribed) { return; } try { if (PhotonNetwork.NetworkingClient != null) { PhotonNetwork.NetworkingClient.EventReceived -= OnEvent; } } catch { } _subscribed = false; } private void Raise(byte code, byte[] payload, ReceiverGroup receivers) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (!IsMultiplayer) { return; } try { PhotonNetwork.RaiseEvent(code, (object)payload, new RaiseEventOptions { Receivers = receivers }, SendOptions.SendReliable); } catch (Exception ex) { _plugin.Log.LogWarning((object)("Shift Report: ready event failed: " + ex.Message)); } } } internal static class Ref { public static readonly FieldInfo? PlayerName = AccessTools.Field(typeof(PlayerAvatar), "playerName"); public static readonly FieldInfo? SteamId = AccessTools.Field(typeof(PlayerAvatar), "steamID"); public static readonly FieldInfo? GrabbedObject = AccessTools.Field(typeof(PhysGrabber), "grabbedPhysGrabObject"); public static readonly FieldInfo? LastGrabber = AccessTools.Field(typeof(PhysGrabObject), "lastPlayerGrabbing"); public static readonly FieldInfo? HurtPlayer = AccessTools.Field(typeof(HurtCollider), "playerCausingHurt"); public static readonly FieldInfo? TogglePlayer = AccessTools.Field(typeof(ItemToggle), "playerTogglePhotonID"); public static readonly FieldInfo? DroneOwner = AccessTools.Field(typeof(ItemDrone), "droneOwner"); public static readonly FieldInfo? CartItems = AccessTools.Field(typeof(PhysGrabCart), "itemsInCartCount"); public static readonly FieldInfo? AllExtractionComplete = AccessTools.Field(typeof(RoundDirector), "allExtractionPointsCompleted"); public static readonly FieldInfo? AllPlayersDead = AccessTools.Field(typeof(RunManager), "allPlayersDead"); public static readonly FieldInfo? ObjectHurtPlayer = AccessTools.Field(typeof(EnemyHealth), "onObjectHurtPlayer"); public static readonly FieldInfo? MenuCursorMesh = AccessTools.Field(typeof(MenuCursor), "mesh"); public static T Get<T>(FieldInfo? field, object? instance) { if (field == null || instance == null) { return default(T); } try { object value = field.GetValue(instance); if (value is T) { return (T)value; } } catch { } return default(T); } } internal sealed class ReportUI { private const float CanvasWidth = 1920f; private const float CanvasHeight = 1080f; private static readonly Color Bg = Color32.op_Implicit(new Color32((byte)8, (byte)9, (byte)8, byte.MaxValue)); private static readonly Color Panel = Color32.op_Implicit(new Color32((byte)16, (byte)18, (byte)16, byte.MaxValue)); private static readonly Color Panel2 = Color32.op_Implicit(new Color32((byte)22, (byte)25, (byte)22, byte.MaxValue)); private static readonly Color HeaderBg = Color32.op_Implicit(new Color32((byte)12, (byte)14, (byte)12, byte.MaxValue)); private static readonly Color Border = Color32.op_Implicit(new Color32((byte)232, (byte)232, (byte)226, byte.MaxValue)); private static readonly Color Muted = Color32.op_Implicit(new Color32((byte)146, (byte)152, (byte)144, byte.MaxValue)); private static readonly Color Green = Color32.op_Implicit(new Color32((byte)157, byte.MaxValue, (byte)138, byte.MaxValue)); private static readonly Color Orange = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)179, (byte)71, byte.MaxValue)); private static readonly Color Cyan = Color32.op_Implicit(new Color32((byte)103, (byte)232, (byte)249, byte.MaxValue)); private static readonly Color Red = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)90, (byte)78, byte.MaxValue)); private static readonly Color[] Palette = (Color[])(object)new Color[6] { Color32.op_Implicit(new Color32((byte)238, (byte)76, (byte)66, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)75, (byte)158, (byte)245, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)91, (byte)214, (byte)105, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)245, (byte)190, (byte)70, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)190, (byte)120, (byte)245, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)80, (byte)220, (byte)210, byte.MaxValue)) }; private readonly Plugin _plugin; private Texture2D? _white; private Texture2D? _cursor; private Font? _font; private bool _ownsFont; private GUIStyle _title; private GUIStyle _subtitle; private GUIStyle _section; private GUIStyle _label; private GUIStyle _small; private GUIStyle _tiny; private GUIStyle _name; private GUIStyle _points; private GUIStyle _right; private GUIStyle _center; private bool _initialized; private bool _failed; private Texture2D? _graph; private Color32[]? _graphPixels; private int _graphHash; private int _graphWidth; private int _graphHeight; private float _graphMax = 10f; private const float RevealDuration = 2.8f; private float _revealStart; private float _reveal = 1f; private bool _revealActive; public ReportUI(Plugin plugin) { _plugin = plugin; } internal void BeginReveal() { _revealStart = Time.unscaledTime; _reveal = 0f; _revealActive = true; } private float ComputeReveal() { if (!_revealActive) { return 1f; } float num = Mathf.Clamp01((Time.unscaledTime - _revealStart) / 2.8f); if (num >= 1f) { _revealActive = false; _reveal = 1f; return 1f; } _reveal = 1f - Mathf.Pow(1f - num, 3f); return _reveal; } internal void Draw(LevelResult result) { //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_001c: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) if (_failed) { return; } try { EnsureInitialized(); _reveal = ComputeReveal(); Matrix4x4 matrix = GUI.matrix; Color color = GUI.color; Color contentColor = GUI.contentColor; int depth = GUI.depth; try { GUI.depth = -1000; GUI.matrix = Matrix4x4.identity; Fill(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), Color.black); float num = Mathf.Min((float)Screen.width / 1920f, (float)Screen.height / 1080f); if (num <= 0f) { num = 1f; } float num2 = ((float)Screen.width - 1920f * num) * 0.5f; float num3 = ((float)Screen.height - 1080f * num) * 0.5f; GUI.matrix = Matrix4x4.TRS(new Vector3(num2, num3, 0f), Quaternion.identity, new Vector3(num, num, 1f)); DrawBackground(); DrawHeader(result); DrawPlayers(result); DrawSummary(result); DrawEnergy(result); DrawFooter(result); DrawCursor(num2, num3, num); } finally { GUI.matrix = matrix; GUI.color = color; GUI.contentColor = contentColor; GUI.depth = depth; } } catch (Exception ex) { _failed = true; _plugin.Log.LogError((object)("Shift Report: UI error: " + ex)); } } internal void Dispose() { DestroyTexture(ref _white); DestroyTexture(ref _cursor); DestroyTexture(ref _graph); if (_ownsFont && (Object)(object)_font != (Object)null) { Object.Destroy((Object)(object)_font); } _font = null; _ownsFont = false; } private void EnsureInitialized() { //IL_0015: 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_0027: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (!_initialized) { _initialized = true; _white = new Texture2D(1, 1, (TextureFormat)4, false) { hideFlags = (HideFlags)61 }; _white.SetPixel(0, 0, Color.white); _white.Apply(false, false); _cursor = CreateCursorTexture(); _font = Font.CreateDynamicFontFromOSFont(new string[5] { "Arial", "Segoe UI", "Noto Sans", "DejaVu Sans", "Liberation Sans" }, 32); _ownsFont = (Object)(object)_font != (Object)null; if ((Object)(object)_font == (Object)null) { _font = GUI.skin.font; } _title = Style(66, (FontStyle)1, (TextAnchor)4); _subtitle = Style(28, (FontStyle)1, (TextAnchor)4); _section = Style(20, (FontStyle)1, (TextAnchor)3); _label = Style(18, (FontStyle)0, (TextAnchor)3); _small = Style(14, (FontStyle)0, (TextAnchor)3); _tiny = Style(11, (FontStyle)0, (TextAnchor)3); _name = Style(23, (FontStyle)1, (TextAnchor)3); _points = Style(44, (FontStyle)1, (TextAnchor)3); _right = Style(16, (FontStyle)0, (TextAnchor)5); _center = Style(15, (FontStyle)1, (TextAnchor)4); } } private GUIStyle Style(int size, FontStyle fontStyle, TextAnchor anchor) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_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_0030: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.label) { font = _font, fontSize = size, fontStyle = fontStyle, alignment = anchor, wordWrap = false, clipping = (TextClipping)1 }; val.normal.textColor = Color.white; return val; } private void DrawBackground() { //IL_0015: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) Fill(new Rect(0f, 0f, 1920f, 1080f), Bg); for (int i = 0; i < 14; i++) { float num = 0.022f * (float)(14 - i) / 14f; Fill(new Rect(0f, 0f, 1920f, 90f + (float)i * 34f), new Color(0f, 0f, 0f, num)); } for (int j = 0; j < 1080; j += 6) { Fill(new Rect(0f, (float)j, 1920f, 1f), new Color(0f, 0f, 0f, 0.045f)); } } private void DrawHeader(LevelResult result) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: 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_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) Color val = (result.Victory ? Border : Red); Frame(new Rect(30f, 24f, 1860f, 168f), new Color(0.05f, 0.055f, 0.05f, 0.96f), val, 2f); Frame(new Rect(48f, 42f, 104f, 104f), Panel2, val, 3f); for (int i = 0; i < 5; i++) { Fill(new Rect(52f + (float)i * 20f, 126f, 9f, 16f), (i % 2 == 0) ? val : Muted); } Label(new Rect(48f, 47f, 104f, 56f), "SR", _title, val); string text = (result.Victory ? L("СМЕНА ЗАВЕРШЕНА", "SHIFT COMPLETE") : L("СМЕНА ПРОВАЛЕНА", "SHIFT FAILED")); ShadowLabel(new Rect(190f, 32f, 1370f, 84f), text, _title, val); string text2 = L("ИТОГО ЗАРАБОТАНО: ", "TOTAL EARNED: ") + Num(Animated(result.TotalPoints)) + L(" ОЧКОВ", " PTS"); Label(new Rect(190f, 112f, 1370f, 44f), text2, _subtitle, Green); Frame(new Rect(1640f, 38f, 220f, 104f), Panel2, val, 2f); Label(new Rect(1652f, 46f, 196f, 20f), L("ДЕНЬ", "DAY"), _tiny, Muted); Label(new Rect(1652f, 62f, 196f, 62f), result.Day.ToString(CultureInfo.InvariantCulture), _title, val); HLine(30f, 204f, 1860f, val, 1f); } private void DrawPlayers(LevelResult result) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_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_0252: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: 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) Rect val = default(Rect); ((Rect)(ref val))..ctor(40f, 214f, 430f, 776f); Frame(val, Panel, Border, 2f); SectionHeader(val, L("ПОКАЗАТЕЛИ БРИГАДЫ", "TEAM PERFORMANCE"), L("ИГРОКОВ: ", "PLAYERS: ") + result.Players.Count.ToString(CultureInfo.InvariantCulture)); if (result.Players.Count == 0) { Label(new Rect(((Rect)(ref val)).x + 20f, ((Rect)(ref val)).y + 90f, ((Rect)(ref val)).width - 40f, 30f), L("НЕТ ДАННЫХ", "NO DATA"), _label, Muted); return; } int count = result.Players.Count; float num = ((Rect)(ref val)).y + 62f; float num2 = 10f; float num3 = Mathf.Clamp((((Rect)(ref val)).height - 78f - num2 * (float)(count - 1)) / (float)count, 96f, 158f); Rect rect = default(Rect); for (int i = 0; i < count; i++) { PlayerStats playerStats = result.Players[i]; Color val2 = PlayerColor(playerStats, i); ((Rect)(ref rect))..ctor(((Rect)(ref val)).x + 14f, num + (float)i * (num3 + num2), ((Rect)(ref val)).width - 28f, num3); Frame(rect, Panel2, val2, 2f); Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 7f, ((Rect)(ref rect)).height), val2); Label(new Rect(((Rect)(ref rect)).x + 20f, ((Rect)(ref rect)).y + 8f, ((Rect)(ref rect)).width - 32f, 28f), Truncate(playerStats.Name, 18).ToUpperInvariant(), _name, Border); Label(new Rect(((Rect)(ref rect)).x + 20f, ((Rect)(ref rect)).y + 34f, ((Rect)(ref rect)).width - 32f, 52f), Num(Animated(playerStats.Points)), _points, (playerStats.Points > 0) ? Green : Muted); List<string> list = Titles.Build(result, playerStats, _plugin.UseRussian); string value = string.Join(" · ", list.ToArray()); Label(new Rect(((Rect)(ref rect)).x + 20f, ((Rect)(ref rect)).y + num3 - 48f, ((Rect)(ref rect)).width - 32f, 20f), Truncate(value, 34), _small, val2); string value2 = L("ПЕРЕНОС ", "CARRY ") + Num(Animated(playerStats.CarryPoints)) + L(" · УБИЙСТВА ", " · KILLS ") + Animated(playerStats.Kills).ToString(CultureInfo.InvariantCulture) + " (+" + Num(Animated(playerStats.KillPoints)) + ")" + L(" · ЭНЕРГИЯ ", " · ENERGY ") + Num(Animated(playerStats.Energy)); Label(new Rect(((Rect)(ref rect)).x + 20f, ((Rect)(ref rect)).y + num3 - 25f, ((Rect)(ref rect)).width - 32f, 18f), Truncate(value2, 54), _tiny, Muted); } } private void DrawSummary(LevelResult result) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00e1: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: 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_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: 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_0433: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val))..ctor(500f, 214f, 880f, 776f); Frame(val, Panel, Border, 2f); SectionHeader(val, L("СВОДКА ПО БРИГАДЕ", "TEAM SUMMARY"), L("ДИНАМИКА", "TIMELINE")); Kpi(new Rect(520f, 282f, 250f, 92f), L("ВСЕГО ОЧКОВ", "TOTAL POINTS"), Num(Animated(result.TotalPoints)), Green); Kpi(new Rect(790f, 282f, 250f, 92f), L("УБИЙСТВ", "KILLS"), Animated(result.TotalKills).ToString(CultureInfo.InvariantCulture), Border); Kpi(new Rect(1060f, 282f, 300f, 92f), L("ЭНЕРГИИ", "ENERGY"), Num(Animated(result.TotalEnergy)), Orange); Label(new Rect(520f, 394f, 300f, 24f), L("ОЧКИ ПО ВРЕМЕНИ", "POINTS OVER TIME"), _small, Muted); DrawLegend(result, 745f, 393f); Rect plot = default(Rect); ((Rect)(ref plot))..ctor(570f, 430f, 760f, 350f); Frame(new Rect(((Rect)(ref plot)).x - 4f, ((Rect)(ref plot)).y - 4f, ((Rect)(ref plot)).width + 8f, ((Rect)(ref plot)).height + 8f), Panel2, new Color(0.24f, 0.27f, 0.24f, 1f), 1f); DrawGraph(result, plot); float num = GraphMax(result); Label(new Rect(520f, ((Rect)(ref plot)).y - 6f, 42f, 20f), Num(num), _right, Muted); Label(new Rect(520f, ((Rect)(ref plot)).y + ((Rect)(ref plot)).height * 0.5f - 10f, 42f, 20f), Num(num * 0.5f), _right, Muted); Label(new Rect(520f, ((Rect)(ref plot)).y + ((Rect)(ref plot)).height - 12f, 42f, 20f), "0", _right, Muted); for (int i = 0; i <= 4; i++) { float num2 = (float)i / 4f; float num3 = ((Rect)(ref plot)).x + ((Rect)(ref plot)).width * num2; string text = FormatTime(result.Duration * num2); Label(new Rect(num3 - 34f, ((Rect)(ref plot)).y + ((Rect)(ref plot)).height + 6f, 68f, 20f), text, _tiny, Muted); } Frame(new Rect(520f, 820f, 840f, 58f), Panel2, new Color(0.25f, 0.28f, 0.25f, 1f), 1f); Label(new Rect(534f, 832f, 260f, 18f), L("ВРЕМЯ СМЕНЫ", "SHIFT TIME"), _tiny, Muted); Label(new Rect(534f, 846f, 260f, 28f), FormatTime(result.Duration), _section, Border); PlayerStats playerStats = ((result.Players.Count > 0) ? result.Players[0] : null); if (playerStats != null) { Label(new Rect(820f, 832f, 520f, 18f), L("ЛИДЕР СМЕНЫ", "SHIFT LEADER"), _tiny, Muted); Label(new Rect(820f, 846f, 520f, 28f), Truncate(playerStats.Name, 20) + " · " + Num(Animated(playerStats.Points)) + L(" ОЧКОВ", " PTS"), _label, PlayerColor(playerStats, 0)); } Label(new Rect(520f, 900f, 840f, 22f), L("ДАННЫЕ СМЕНЫ ЗАФИКСИРОВАНЫ", "SHIFT DATA LOCKED"), _tiny, Muted); } private void DrawEnergy(LevelResult result) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_0522: 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_01e1: 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_020a: 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_0247: 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_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val))..ctor(1410f, 214f, 470f, 776f); Frame(val, Panel, Border, 2f); SectionHeader(val, L("ЭНЕРГОЗАТРАТЫ", "ENERGY SPENT"), L("БАТАРЕИ", "BATTERIES")); Label(new Rect(1430f, 286f, 430f, 20f), L("ВСЕГО ПОТРАЧЕНО", "TOTAL SPENT"), _tiny, Muted); Label(new Rect(1430f, 304f, 430f, 68f), Num(Animated(result.TotalEnergy)), _title, Orange); Label(new Rect(1430f, 370f, 430f, 22f), L("ЕДИНИЦ ЭНЕРГИИ", "ENERGY UNITS"), _small, Muted); HLine(1430f, 404f, 430f, new Color(0.25f, 0.28f, 0.25f, 1f), 1f); float num = 1f; for (int i = 0; i < result.Players.Count; i++) { if (result.Players[i].Energy > num) { num = result.Players[i].Energy; } } if (result.Players.Count == 0) { Label(new Rect(1430f, 430f, 430f, 26f), L("НЕТ ДАННЫХ", "NO DATA"), _label, Muted); } else { Rect rect = default(Rect); for (int j = 0; j < result.Players.Count; j++) { PlayerStats playerStats = result.Players[j]; Color color = PlayerColor(playerStats, j); float num2 = 428f + (float)j * 74f; Label(new Rect(1430f, num2, 120f, 22f), Truncate(playerStats.Name, 12).ToUpperInvariant(), _small, color); Label(new Rect(1430f, num2 + 21f, 120f, 16f), Num(Animated(playerStats.Energy)), _tiny, Muted); ((Rect)(ref rect))..ctor(1552f, num2 + 5f, 250f, 22f); Frame(rect, new Color(0.07f, 0.08f, 0.07f, 1f), new Color(0.3f, 0.33f, 0.3f, 1f), 1f); float num3 = playerStats.Energy * _reveal; if (num3 > 0.01f) { float num4 = ((Rect)(ref rect)).width * Mathf.Clamp01(num3 / num); float num5 = num4 * (playerStats.WeaponEnergy / playerStats.Energy); float num6 = num4 * (playerStats.DroneEnergy / playerStats.Energy); float num7 = Mathf.Max(0f, num4 - num5 - num6); Fill(new Rect(((Rect)(ref rect)).x + 1f, ((Rect)(ref rect)).y + 1f, num5, ((Rect)(ref rect)).height - 2f), Orange); Fill(new Rect(((Rect)(ref rect)).x + 1f + num5, ((Rect)(ref rect)).y + 1f, num6, ((Rect)(ref rect)).height - 2f), Cyan); Fill(new Rect(((Rect)(ref rect)).x + 1f + num5 + num6, ((Rect)(ref rect)).y + 1f, num7, ((Rect)(ref rect)).height - 2f), Muted); } Label(new Rect(1810f, num2 + 2f, 52f, 22f), Num(Animated(playerStats.Energy)), _right, Border); } } HLine(1430f, 790f, 430f, new Color(0.25f, 0.28f, 0.25f, 1f), 1f); LegendSwatch(new Rect(1430f, 810f, 12f, 12f), Orange, L("ОРУЖИЕ", "WEAPONS")); LegendSwatch(new Rect(1560f, 810f, 12f, 12f), Cyan, L("ДРОНЫ", "DRONES")); LegendSwatch(new Rect(1690f, 810f, 12f, 12f), Muted, L("ПРОЧЕЕ", "OTHER")); Label(new Rect(1430f, 840f, 430f, 18f), L("РАСХОД БАТАРЕЙ: ВЫСТРЕЛЫ, ЛУЧИ, ДРОНЫ", "BATTERY DRAIN: SHOTS, BEAMS, DRONES"), _tiny, Muted); if (result.UnattributedEnergy > 0.05f) { Label(new Rect(1430f, 864f, 430f, 18f), L("НЕ УЧТЕНО: ", "UNACCOUNTED: ") + Num(result.UnattributedEnergy * _reveal), _tiny, Red); } Label(new Rect(1430f, 900f, 430f, 18f), L("ЭНЕРГИЯ НЕ ДАЁТ ОЧКОВ", "ENERGY DOES NOT GRANT POINTS"), _tiny, Muted); } private void DrawFooter(LevelResult result) { //IL_0015: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: 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_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) Frame(new Rect(40f, 1000f, 1840f, 50f), HeaderBg, Border, 1f); Label(new Rect(56f, 1014f, 500f, 24f), L("СМЕНА №", "SHIFT #") + result.Day.ToString(CultureInfo.InvariantCulture) + " · " + FormatTime(result.Duration) + " · " + result.TotalPoints.ToString(CultureInfo.InvariantCulture) + L(" ОЧКОВ", " PTS"), _small, Muted); bool localReady = _plugin.Ready.LocalReady; bool allReady = _plugin.Ready.AllReady; int readyCount = _plugin.Ready.ReadyCount; int expected = _plugin.Ready.Expected; string text = (allReady ? L("ВСЕ ГОТОВЫ", "EVERYONE READY") : (localReady ? L("ВЫ ГОТОВЫ · ЖДЁМ ОСТАЛЬНЫХ", "YOU ARE READY · WAITING") : (L("УДЕРЖИВАЙТЕ ПРОБЕЛ · ", "HOLD SPACE · ") + _plugin.ReadyHoldSeconds.ToString("0.0", CultureInfo.InvariantCulture) + L(" СЕК", " SEC")))); Color color = (allReady ? Green : (localReady ? Green : Border)); Label(new Rect(560f, 1004f, 700f, 20f), text, _center, color); Rect rect = default(Rect); ((Rect)(ref rect))..ctor(610f, 1028f, 600f, 10f); Frame(rect, new Color(0.07f, 0.08f, 0.07f, 1f), new Color(0.3f, 0.33f, 0.3f, 1f), 1f); float num = (allReady ? 1f : _plugin.Ready.HoldProgress); if (num > 0f) { Fill(new Rect(((Rect)(ref rect)).x + 1f, ((Rect)(ref rect)).y + 1f, (((Rect)(ref rect)).width - 2f) * num, ((Rect)(ref rect)).height - 2f), (localReady || allReady) ? Green : Orange); } Label(new Rect(1560f, 1004f, 300f, 38f), L("ГОТОВЫ: ", "READY: ") + readyCount.ToString(CultureInfo.InvariantCulture) + "/" + expected.ToString(CultureInfo.InvariantCulture), _section, allReady ? Green : Border); if (!localReady && !allReady) { Label(new Rect(1560f, 1034f, 300f, 14f), L("ЗАЖМИ КЛАВИШУ ДО КОНЦА", "HOLD UNTIL THE BAR FILLS"), _tiny, Muted); } } private void DrawCursor(float offsetX, float offsetY, float scale) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_cursor == (Object)null)) { Vector3 mousePosition = Input.mousePosition; float num = (mousePosition.x - offsetX) / scale; float num2 = ((float)Screen.height - mousePosition.y - offsetY) / scale; if (!(num < -40f) && !(num2 < -40f) && !(num > 1960f) && !(num2 > 1120f)) { GUI.DrawTexture(new Rect(num - 3f, num2 - 2f, 34f, 34f), (Texture)(object)_cursor); } } } private static Texture2D CreateCursorTexture() { //IL_0015: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Expected O, but got Unknown Color32[] array = (Color32[])(object)new Color32[2304]; for (int i = 0; i < array.Length; i++) { array[i] = new Color32((byte)0, (byte)0, (byte)0, (byte)0); } Vector2[] points = (Vector2[])(object)new Vector2[7] { new Vector2(4f, 46f), new Vector2(44f, 28f), new Vector2(25f, 24f), new Vector2(34f, 4f), new Vector2(22f, 4f), new Vector2(14f, 22f), new Vector2(4f, 12f) }; FillPolygon(array, 48, 48, Expand(points, 2.4f), new Color32((byte)8, (byte)8, (byte)8, byte.MaxValue)); FillPolygon(array, 48, 48, points, new Color32(byte.MaxValue, (byte)138, (byte)26, byte.MaxValue)); Vector2[] points2 = (Vector2[])(object)new Vector2[3] { new Vector2(8f, 38f), new Vector2(18f, 33f), new Vector2(12f, 28f) }; FillPolygon(array, 48, 48, points2, new Color32(byte.MaxValue, (byte)205, (byte)120, byte.MaxValue)); Texture2D val = new Texture2D(48, 48, (TextureFormat)4, false) { hideFlags = (HideFlags)61, filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; val.SetPixels32(array); val.Apply(false, false); return val; } private static Vector2[] Expand(Vector2[] points, float amount) { //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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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) Vector2 val = Vector2.zero; for (int i = 0; i < points.Length; i++) { val += points[i]; } val /= (float)points.Length; Vector2[] array = (Vector2[])(object)new Vector2[points.Length]; for (int j = 0; j < points.Length; j++) { int num = j; Vector2 val2 = points[j]; Vector2 val3 = points[j] - val; array[num] = val2 + ((Vector2)(ref val3)).normalized * amount; } return array; } private static void FillPolygon(Color32[] pixels, int width, int height, Vector2[] points, Color32 color) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_010f: 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_017f: Unknown result type (might be due to invalid IL or missing references) float num = float.MaxValue; float num2 = float.MinValue; for (int i = 0; i < points.Length; i++) { if (points[i].y < num) { num = points[i].y; } if (points[i].y > num2) { num2 = points[i].y; } } List<float> list = new List<float>(8); int num3 = Mathf.Max(0, Mathf.FloorToInt(num)); int num4 = Mathf.Min(height - 1, Mathf.CeilToInt(num2)); for (int j = num3; j <= num4; j++) { float num5 = (float)j + 0.5f; list.Clear(); for (int k = 0; k < points.Length; k++) { Vector2 val = points[k]; Vector2 val2 = points[(k + 1) % points.Length]; if ((val.y <= num5 && val2.y > num5) || (val2.y <= num5 && val.y > num5)) { float num6 = (num5 - val.y) / (val2.y - val.y); list.Add(val.x + num6 * (val2.x - val.x)); } } list.Sort(); for (int l = 0; l + 1 < list.Count; l += 2) { int num7 = Mathf.Max(0, Mathf.CeilToInt(list[l] - 0.5f)); int num8 = Mathf.Min(width - 1, Mathf.FloorToInt(list[l + 1] - 0.5f)); for (int m = num7; m <= num8; m++) { pixels[j * width + m] = color; } } } } private void DrawLegend(LevelResult result, float x, float y) { //IL_0016: 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_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_004d: 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) float num = x; for (int i = 0; i < result.Players.Count && i < 4; i++) { PlayerStats playerStats = result.Players[i]; Color color = PlayerColor(playerStats, i); Fill(new Rect(num, y + 5f, 10f, 10f), color); Label(new Rect(num + 15f, y, 130f, 20f), Truncate(playerStats.Name, 13), _tiny, Muted); num += 150f; } } private void DrawGraph(LevelResult result, Rect plot) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Max(16, Mathf.RoundToInt(((Rect)(ref plot)).width)); int num2 = Mathf.Max(16, Mathf.RoundToInt(((Rect)(ref plot)).height)); int revealBucket = (_revealActive ? Mathf.RoundToInt(_reveal * 24f) : 24); int num3 = GraphHash(result, revealBucket); if ((Object)(object)_graph == (Object)null || _graphWidth != num || _graphHeight != num2 || _graphHash != num3) { BuildGraph(result, num, num2, num3, _reveal); } if ((Object)(object)_graph != (Object)null) { GUI.DrawTexture(plot, (Texture)(object)_graph, (ScaleMode)0, false); } if (_revealActive) { float num4 = ((Rect)(ref plot)).x + ((Rect)(ref plot)).width * _reveal; Fill(new Rect(num4 - 1f, ((Rect)(ref plot)).y, 2f, ((Rect)(ref plot)).height), new Color(0.62f, 1f, 0.54f, 0.55f)); Fill(new Rect(num4 - 3f, ((Rect)(ref plot)).y + ((Rect)(ref plot)).height * 0.5f - 3f, 6f, 6f), Green); } else { float num5 = Mathf.Repeat(Time.unscaledTime * 0.09f, 1f); Fill(new Rect(((Rect)(ref plot)).x + ((Rect)(ref plot)).width * num5, ((Rect)(ref plot)).y, 1f, ((Rect)(ref plot)).height), new Color(0.55f, 1f, 0.54f, 0.07f)); } } private int GraphHash(LevelResult result, int revealBucket) { int hashCode = result.Duration.GetHashCode(); hashCode = hashCode * 397 + revealBucket; hashCode = hashCode * 397 + result.Players.Count; for (int i = 0; i < result.Players.Count; i++) { PlayerStats playerStats = result.Players[i]; hashCode = hashCode * 397 + playerStats.Points; hashCode = hashCode * 397 + playerStats.PointSamples.Count; hashCode = hashCode * 397 + playerStats.Id.GetHashCode(); } return hashCode; } private float GraphMax(LevelResult result) { float num = 0f; for (int i = 0; i < result.Players.Count; i++) { List<float> pointSamples = result.Players[i].PointSamples; for (int j = 0; j < pointSamples.Count; j++) { if (pointSamples[j] > num) { num = pointSamples[j]; } } } num = Mathf.Max(10f, num); if (num <= 100f) { return Mathf.Ceil(num / 20f) * 20f; } if (num <= 500f) { return Mathf.Ceil(num / 50f) * 50f; } if (num <= 2000f) { return Mathf.Ceil(num / 100f) * 100f; } return Mathf.Ceil(num / 500f) * 500f; } private void BuildGraph(LevelResult result, int width, int height, int hash, float reveal) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: 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_028e: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Expected O, but got Unknown //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_graph == (Object)null || _graphWidth != width || _graphHeight != height) { DestroyTexture(ref _graph); _graphPixels = (Color32[]?)(object)new Color32[width * height]; } _graphHash = hash; _graphWidth = width; _graphHeight = height; _graphMax = GraphMax(result); Color32[] graphPixels = _graphPixels; Color32 val = default(Color32); ((Color32)(ref val))..ctor((byte)13, (byte)15, (byte)13, byte.MaxValue); for (int i = 0; i < graphPixels.Length; i++) { graphPixels[i] = val; } Color color = default(Color); ((Color)(ref color))..ctor(0.18f, 0.2f, 0.18f, 1f); for (int j = 1; j <= 4; j++) { int x = Mathf.RoundToInt((float)(width - 1) * ((float)j / 5f)); DrawVLine(graphPixels, width, height, x, 0, height - 1, color); } for (int k = 1; k <= 4; k++) { int y = Mathf.RoundToInt((float)(height - 1) * ((float)k / 5f)); DrawHLine(graphPixels, width, height, y, 0, width - 1, color); } for (int l = 0; l < result.Players.Count; l++) { PlayerStats playerStats = result.Players[l]; List<float> pointSamples = playerStats.PointSamples; if (pointSamples.Count == 0) { continue; } Color32 color2 = Color32.op_Implicit(PlayerColor(playerStats, l)); int num = -1; int num2 = -1; int num3 = Mathf.Clamp(Mathf.CeilToInt((float)pointSamples.Count * Mathf.Clamp01(reveal)), 1, pointSamples.Count); if (reveal <= 0.001f) { num3 = 0; } for (int m = 0; m < num3; m++) { int num4 = Mathf.RoundToInt(((pointSamples.Count <= 1) ? 0f : ((float)m / (float)(pointSamples.Count - 1))) * (float)(width - 1)); int num5 = Mathf.RoundToInt(Mathf.Clamp(pointSamples[m], 0f, _graphMax) / _graphMax * (float)(height - 1)); if (num >= 0) { DrawLine(graphPixels, width, height, num, num2, num4, num5, color2, 2); } num = num4; num2 = num5; } if (num >= 0) { FillCircle(graphPixels, width, height, num, num2, 3, color2); } } DrawHLine(graphPixels, width, height, 0, 0, width - 1, new Color(0.35f, 0.38f, 0.35f, 1f)); if ((Object)(object)_graph == (Object)null) { _graph = new Texture2D(width, height, (TextureFormat)4, false) { hideFlags = (HideFlags)61, filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; } _graph.SetPixels32(graphPixels); _graph.Apply(false, false); } private void Kpi(Rect rect, string caption, string value, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) Frame(rect, Panel2, new Color(0.26f, 0.29f, 0.26f, 1f), 1f); Label(new Rect(((Rect)(ref rect)).x + 14f, ((Rect)(ref rect)).y + 10f, ((Rect)(ref rect)).width - 28f, 18f), caption, _tiny, Muted); Label(new Rect(((Rect)(ref rect)).x + 14f, ((Rect)(ref rect)).y + 28f, ((Rect)(ref rect)).width - 28f, 54f), value, _points, color); } private void SectionHeader(Rect panel, string title, string right) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) Fill(new Rect(((Rect)(ref panel)).x + 2f, ((Rect)(ref panel)).y + 2f, ((Rect)(ref panel)).width - 4f, 48f), HeaderBg); HLine(((Rect)(ref panel)).x + 2f, ((Rect)(ref panel)).y + 50f, ((Rect)(ref panel)).width - 4f, Border, 1f); Label(new Rect(((Rect)(ref panel)).x + 16f, ((Rect)(ref panel)).y + 11f, ((Rect)(ref panel)).width - 160f, 28f), title, _section, Border); Label(new Rect(((Rect)(ref panel)).x + ((Rect)(ref panel)).width - 146f, ((Rect)(ref panel)).y + 14f, 130f, 22f), right, _right, Muted); } private void LegendSwatch(Rect rect, Color color, string text) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Fill(rect, color); Label(new Rect(((Rect)(ref rect)).x + 17f, ((Rect)(ref rect)).y - 3f, 105f, 18f), text, _tiny, Muted); } private Color PlayerColor(PlayerStats p, int index) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) int num = ((p.Actor != 0) ? Mathf.Abs(p.Actor) : Mathf.Abs(p.Id.GetHashCode())); return Palette[num % Palette.Length]; } private string L(string ru, string en) { if (!_plugin.UseRussian) { return en; } return ru; } private int Animated(int value) { return Mathf.RoundToInt((float)value * _reveal); } private float Animated(float value) { return value * _reveal; } private static string Num(int value) { return value.ToString("N0", CultureInfo.InvariantCulture).Replace(",", " "); } private static string Num(float value) { return Num(Mathf.RoundToInt(value)); } private static string FormatTime(float seconds) { int num = Mathf.Max(0, Mathf.RoundToInt(seconds)); int num2 = num / 60; int num3 = num % 60; return num2.ToString("00", CultureInfo.InvariantCulture) + ":" + num3.ToString("00", CultureInfo.InvariantCulture); } private static string Truncate(string? value, int max) { if (string.IsNullOrEmpty(value)) { return string.Empty; } if (value.Length <= max) { return value; } return value.Substring(0, Mathf.Max(1, max - 1)) + "…"; } private void Fill(Rect rect, Color color) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_white == (Object)null)) { Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)_white); GUI.color = color2; } } private void Frame(Rect rect, Color fill, Color border, float thickness) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) Fill(rect, fill); Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, thickness), border); Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).yMax - thickness, ((Rect)(ref rect)).width, thickness), border); Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, thickness, ((Rect)(ref rect)).height), border); Fill(new Rect(((Rect)(ref rect)).xMax - thickness, ((Rect)(ref rect)).y, thickness, ((Rect)(ref rect)).height), border); } private void HLine(float x, float y, float width, Color color, float thickness) { //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) Fill(new Rect(x, y, width, thickness), color); } private void Label(Rect rect, string text, GUIStyle style, Color color) { //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_000c: Unknown result type (might be due to invalid IL or missing references) Color contentColor = GUI.contentColor; GUI.contentColor = color; GUI.Label(rect, text, style); GUI.contentColor = contentColor; } private void ShadowLabel(Rect rect, string text, GUIStyle style, Color color) { //IL_0000: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) Color contentColor = GUI.contentColor; GUI.contentColor = new Color(0f, 0f, 0f, 0.65f); GUI.Label(new Rect(((Rect)(ref rect)).x + 3f, ((Rect)(ref rect)).y + 3f, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), text, style); GUI.contentColor = color; GUI.Label(rect, text, style); GUI.contentColor = contentColor; } private void DestroyTexture(ref Texture2D? texture) { if ((Object)(object)texture != (Object)null) { Object.Destroy((Object)(object)texture); texture = null; } } private static void DrawLine(Color32[] pixels, int width, int height, int x0, int y0, int x1, int y1, Color32 color, int thickness) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Abs(x1 - x0); int num2 = ((x0 < x1) ? 1 : (-1)); int num3 = -Mathf.Abs(y1 - y0); int num4 = ((y0 < y1) ? 1 : (-1)); int num5 = num + num3; while (true) { SetPixel(pixels, width, height, x0, y0, color); if (thickness > 1) { SetPixel(pixels, width, height, x0 + 1, y0, color); SetPixel(pixels, width, height, x0, y0 + 1, color); if (thickness > 2) { SetPixel(pixels, width, height, x0 + 1, y0 + 1, color); } } if (x0 != x1 || y0 != y1) { int num6 = 2 * num5; if (num6 >= num3) { num5 += num3; x0 += num2; } if (num6 <= num) { num5 += num; y0 += num4; } continue; } break; } } private static void DrawHLine(Color32[] pixels, int width, int height, int y, int x0, int x1, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) Color32 val = Color32.op_Implicit(color); if (y >= 0 && y < height) { for (int i = Mathf.Max(0, x0); i <= Mathf.Min(width - 1, x1); i++) { pixels[y * width + i] = val; } } } private static void DrawVLine(Color32[] pixels, int width, int height, int x, int y0, int y1, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) Color32 val = Color32.op_Implicit(color); if (x >= 0 && x < width) { for (int i = Mathf.Max(0, y0); i <= Mathf.Min(height - 1, y1); i++) { pixels[i * width + x] = val; } } } private static void FillCircle(Color32[] pixels, int width, int height, int cx, int cy, int radius, Color32 color) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) for (int i = -radius; i <= radius; i++) { for (int j = -radius; j <= radius; j++) { if (j * j + i * i <= radius * radius) { SetPixel(pixels, width, height, cx + j, cy + i, color); } } } } private static void SetPixel(Color32[] pixels, int width, int height, int x, int y, Color32 color) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (x >= 0 && x < width && y >= 0 && y < height) { pixels[y * width + x] = color; } } } internal static class Safe { private const float LogInterval = 10f; private static readonly Dictionary<string, float> LastLog = new Dictionary<string, float>(StringComparer.Ordinal); public static void Run(string site, Action action) { try { action(); } catch (Exception e) { Report(site, e); } } public static void Report(string site, Exception e) { Plugin instance = Plugin.Instance; if (!((Object)(object)instance == (Object)null)) { float realtimeSinceStartup = Time.realtimeSinceStartup; if (!LastLog.TryGetValue(site, out var value) || !(realtimeSinceStartup - value < 10f)) { LastLog[site] = realtimeSinceStartup; instance.Log.LogWarning((object)("Shift Report: " + site + " skipped (" + e.GetType().Name + ": " + e.Message + ")")); } } } } internal static class SnapshotCodec { private const uint Magic = 827476051u; private const byte Version = 1; private const int MaxPlayers = 16; private const int MaxSamples = 4096; private const int MaxString = 96; public static byte[] Encode(LevelResult result) { using MemoryStream memoryStream = new MemoryStream(512 + result.Players.Count * 512); using BinaryWriter binaryWriter = new BinaryWriter(memoryStream, Encoding.UTF8, leaveOpen: true); binaryWriter.Write(827476051u); binaryWriter.Write((byte)1); binaryWriter.Write(result.Day); binaryWriter.Write(result.Duration); binaryWriter.Write(result.Victory); binaryWriter.Write(result.UnattributedEnergy); binaryWriter.Write((byte)Math.Min(result.Players.Count, 16)); for (int i = 0; i < result.Players.Count && i < 16; i++) { PlayerStats playerStats = result.Players[i]; binaryWriter.Write(Clip(playerStats.Id)); binaryWriter.Write(Clip(playerStats.Name)); binaryWriter.Write(playerStats.Actor); binaryWriter.Write(playerStats.CarrySeconds); binaryWriter.Write(playerStats.KillPoints); binaryWriter.Write(playerStats.Kills); binaryWriter.Write(playerStats.Energy); binaryWriter.Write(playerStats.WeaponEnergy); binaryWriter.Write(playerStats.DroneEnergy); binaryWriter.Write(playerStats.OtherEnergy); int num = Math.Min(playerStats.PointSamples.Count, 4096); binaryWriter.Write((ushort)num); for (int j = 0; j < num; j++) { binaryWriter.Write(playerStats.PointSamples[j]); } num = Math.Min(playerStats.EnergySamples.Count, 4096); binaryWriter.Write((ushort)num); for (int k = 0; k < num; k++) { binaryWriter.Write(playerStats.EnergySamples[k]); } } binaryWriter.Flush(); return memoryStream.ToArray(); } public static bool TryDecode(byte[]? bytes, out LevelResult? result) { result = null; if (bytes == null || bytes.Length < 24) { return false; } try { using MemoryStream input = new MemoryStream(bytes, writable: false); using BinaryReader binaryReader = new BinaryReader(input, Encoding.UTF8, leaveOpen: true); if (binaryReader.ReadUInt32() != 827476051) { return false; } if (binaryReader.ReadByte() != 1) { return false; } LevelResult levelResult = new LevelResult { Day = binaryReader.ReadInt32(), Duration = binaryReader.ReadSingle(), Victory = binaryReader.ReadBoolean(), UnattributedEnergy = binaryReader.ReadSingle(), Remote = true }; int num = binaryReader.ReadByte(); if (num < 0 || num > 16) { return false; } for (int i = 0; i < num; i++) { PlayerStats playerStats = new PlayerStats { Id = ReadString(binaryReader), Name = ReadString(binaryReader), Actor = binaryReader.ReadInt32(), CarrySeconds = binaryReader.ReadSingle(), KillPoints = binaryReader.ReadInt32(), Kills = binaryReader.ReadInt32(), Energy = binaryReader.ReadSingle(), WeaponEnergy = binaryReader.ReadSingle(), DroneEnergy = binaryReader.ReadSingle(), OtherEnergy = binaryReader.ReadSingle() }; int num2 = binaryReader.ReadUInt16(); if (num2 < 0 || num2 > 4096) { return false; } for (int j = 0; j < num2; j++) { playerStats.PointSamples.Add(binaryReader.ReadSingle()); } num2 = binaryReader.ReadUInt16(); if (num2 < 0 || num2 > 4096) { return false; } for (int k = 0; k < num2; k++) { playerStats.EnergySamples.Add(binaryReader.ReadSingle()); } levelResult.Players.Add(playerStats); } levelResult.Recalculate(); result = levelResult; return true; } catch { return false; } } private static string Clip(string? value) { if (string.IsNullOrEmpty(value)) { return string.Empty; } if (value.Length > 96) { return value.Substring(0, 96); } return value; } private static string ReadString(BinaryReader reader) { string text = reader.ReadString(); if (text.Length > 96) { return text.Substring(0, 96); } return text; } } internal sealed class StatsTracker { private readonly struct AttackerInfo { public readonly PlayerAvatar Player; public readonly float At; public AttackerInfo(PlayerAvatar player, float at) { Player = player; At = at; } } private readonly Plugin _plugin; private readonly List<PlayerStats> _players = new List<PlayerStats>(8); private readonly Dictionary<string, PlayerStats> _byId = new Dictionary<string, PlayerStats>(StringComparer.Ordinal); private readonly Dictionary<int, ItemBattery> _batteries = new Dictionary<int, ItemBattery>(64); private readonly Dictionary<int, float> _batteryLife = new Dictionary<int, float>(64); private readonly Dictionary<int, PlayerAvatar> _batteryUser = new Dictionary<int, PlayerAvatar>(64); private readonly Dictionary<int, AttackerInfo> _lastAttacker = new Dictionary<int, AttackerInfo>(32); private readonly HashSet<int> _killed = new HashSet<int>(); private readonly List<int> _stale = new List<int>(16); private bool _active; private bool _finalized; private float _levelStart; private float _lastCarryTick; private float _nextCarryTick; private float _nextEnergyTick; private float _nextSample; private float _nextScan; private int _sampleCount; private int _day; private int _startLevelsCompleted; private float _unattributedEnergy; private LevelResult? _result; public bool Active => _active; public bool HasResult => _result != null; public LevelResult? Result => _result; public int StartLevelsCompleted => _startLevelsCompleted; public int CurrentDay => _day; public StatsTracker(Plugin plugin) { _plugin = plugin; } public void BeginLevel() { _players.Clear(); _byId.Clear(); _batteries.Clear(); _batteryLife.Clear(); _batteryUser.Clear(); _lastAttacker.Clear(); _killed.Clear(); _stale.Clear(); _active = true; _finalized = false; _result = null; _sampleCount = 0; _unattributedEnergy = 0f; _levelStart = Time.time; _lastCarryTick = _levelStart; _nextCarryTick = _levelStart + 0.2f; _nextEnergyTick = _levelStart + 0.25f; _nextSample = _levelStart + 2f; _nextScan = _levelStart; _day = Mathf.Max(1, (_startLevelsCompleted = (((Object)(object)RunManager.instance != (Object)null) ? RunManager.instance.levelsCompleted : 0)) + 1); EnsurePlayers(); AppendSample(); ScanBatteries(); _plugin.Log.LogInfo((object)$"Shift Report: level started, day {_day}"); } public void Update() { if (!_active) { return; } float time = Time.time; if (time >= _nextCarryTick) { float num = Mathf.Clamp(time - _lastCarryTick, 0f, 0.5f); _lastCarryTick = time; _nextCarryTick = time + 0.2f; EnsurePlayers(); for (int i = 0; i < _players.Count; i++) { PlayerStats playerStats = _players[i]; if (IsCarryingValuable(playerStats)) { playerStats.CarrySeconds += num * _plugin.CarryPointsPerSecond; } } } if (_plugin.TrackEnergy && time >= _nextEnergyTick) { _nextEnergyTick = time + 0.25f; SampleEnergy(); } if (time >= _nextScan) { _nextScan = time + 5f; ScanBatteries(); } if (time >= _nextSample) { _nextSample = time + 2f; AppendSample(); } } public void HandleLevelExit() { if (_active && !_finalized) { bool flag = (((Object)(object)RunManager.instance != (Object)null) ? RunManager.instance.levelsCompleted : 0) > _startLevelsCompleted; bool flag2 = Ref.Get<bool>(Ref.AllPlayersDead, RunManager.instance); if (flag || flag2) { Finalize(flag && !flag2); } } } public void TryFinalizeFromOutro() { if (_active && !_finalized && SafeRunIsLevel()) { bool flag = Ref.Get<bool>(Ref.AllExtractionComplete, RoundDirector.instance); bool flag2 = Ref.Get<bool>(Ref.AllPlayersDead, RunManager.instance); if (flag || flag2) { Finalize(flag && !flag2); } } } public void ApplyRemote(LevelResult result) { if (result != null) { if (_active && result.Day != _day) { _plugin.Log.LogInfo((object)$"Shift Report: ignored stale result for day {result.Day} (current {_day})"); return; } result.Remote = true; result.Recalculate(); _result = result; _active = false; _finalized = true; _plugin.OnResultReady(result); _plugin.Log.LogInfo((object)$"Shift Report: applied remote result, {result.Players.Count} players"); } } private void Finalize(bool victory) { if (_active && !_finalized) { EnsurePlayers(); AppendSample(); LevelResult levelResult = new LevelResult { Day = _day, Duration = Mathf.Max(1f, Time.time - _levelStart), Victory = victory, Remote = false, Revision = _sampleCount + 1, UnattributedEnergy = _unattributedEnergy }; for (int i = 0; i < _players.Count; i++) { PlayerStats playerStats = _players[i]; playerStats.PadSamples(_sampleCount); levelResult.Players.Add(playerStats); } levelResult.Recalculate(); _result = levelResult; _active = false; _finalized = true; _plugin.Log.LogInfo((object)($"Shift Report: level finished, victory={victory}, day={_day}, " + $"players={levelResult.Players.Count}, points={levelResult.TotalPoints}, energy={levelResult.TotalEnergy:0.0}")); if (GameManager.Multiplayer() && PhotonNetwork.IsMasterClient) { _plugin.Network.Send(levelResult); } _plugin.OnResultReady(levelResult); } } private void AppendSample() { EnsurePlayers();