Decompiled source of Kain Advanced Scoreboard v0.1.3

BepInEx/plugins/Kain_Advanced_Scoreboard/Kain_Advanced_Scoreboard.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using Agents;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using ChainedPuzzles;
using Enemies;
using GTFO.API;
using GameData;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using KainAdvancedScoreboard.Core;
using KainAdvancedScoreboard.Localization;
using KainAdvancedScoreboard.Network;
using KainAdvancedScoreboard.Patches;
using KainAdvancedScoreboard.Runtime;
using KainAdvancedScoreboard.UI;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.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 KainAdvancedScoreboard.UI
{
	public sealed class ScoreboardPanel
	{
		private sealed class ScoreRow
		{
			public string Label => ScoreboardLocalization.Pick(EnglishLabel, ChineseLabel);

			private string EnglishLabel { get; }

			private string ChineseLabel { get; }

			public Func<PlayerScoreStats, string> Value { get; }

			public Func<PlayerScoreStats, bool>? Highlight { get; }

			public ScoreRow(string englishLabel, string chineseLabel, Func<PlayerScoreStats, string> value, Func<PlayerScoreStats, bool>? highlight)
			{
				EnglishLabel = englishLabel;
				ChineseLabel = chineseLabel;
				Value = value;
				Highlight = highlight;
			}
		}

		private const int MaxPlayerColumns = 4;

		private const float HeaderHeight = 64f;

		private const float RowHeight = 30f;

		private const float HeaderRowHeight = 42f;

		private readonly Func<ScoreboardSnapshot> _snapshotProvider;

		private readonly List<Text> _highlightTexts = new List<Text>();

		private readonly List<Image> _highlightBackplates = new List<Image>();

		private readonly List<Image> _scanLineLayers = new List<Image>();

		private GameObject? _root;

		private RectTransform? _content;

		private RectTransform? _scanLine;

		private Image? _frameImage;

		private Outline? _frameOutline;

		private Text? _title;

		private Text? _subtitle;

		private Font? _font;

		private ScoreboardSnapshot _snapshot = ScoreboardSnapshot.Empty;

		private float _visibleSince;

		public bool Visible
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				if ((Object)_root != (Object)null)
				{
					return _root.activeSelf;
				}
				return false;
			}
		}

		public ScoreboardPanel(Func<ScoreboardSnapshot> snapshotProvider)
		{
			_snapshotProvider = snapshotProvider;
		}

		public void Create()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_007f: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: 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_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)_root != (Object)null))
			{
				_font = Resources.GetBuiltinResource<Font>("Arial.ttf");
				_root = new GameObject("KAS_ScoreboardCanvas");
				Object.DontDestroyOnLoad((Object)_root);
				Canvas obj = _root.AddComponent<Canvas>();
				obj.renderMode = (RenderMode)0;
				obj.sortingOrder = 6000;
				CanvasScaler obj2 = _root.AddComponent<CanvasScaler>();
				obj2.uiScaleMode = (ScaleMode)1;
				obj2.referenceResolution = new Vector2(2560f, 1440f);
				obj2.matchWidthOrHeight = 0.5f;
				_root.AddComponent<GraphicRaycaster>();
				GameObject obj3 = CreateRect("Dim", _root.transform);
				Stretch(obj3, 0f, 0f, 0f, 0f);
				((Graphic)obj3.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.18f);
				GameObject val = CreateRect("Frame", _root.transform);
				RectTransform component = val.GetComponent<RectTransform>();
				component.anchorMin = new Vector2(0.03f, 0.06f);
				component.anchorMax = new Vector2(0.97f, 0.94f);
				component.offsetMin = Vector2.zero;
				component.offsetMax = Vector2.zero;
				_frameImage = val.AddComponent<Image>();
				((Graphic)_frameImage).color = new Color(0f, 0f, 0f, 0.34f);
				_frameOutline = val.AddComponent<Outline>();
				((Shadow)_frameOutline).effectColor = new Color(0.78f, 0.8f, 0.82f, 0.2f);
				((Shadow)_frameOutline).effectDistance = new Vector2(2f, -2f);
				CreateFrameDecorations(val.transform);
				_title = CreateText("Title", val.transform, string.Empty, 30, (TextAnchor)4, new Color(1f, 0.88f, 0.48f, 1f));
				SetRect(((Component)_title).gameObject, 24f, -50f, 24f, 8f, new Vector2(0f, 1f), new Vector2(1f, 1f));
				AddShadow(_title, new Color(0f, 0f, 0f, 0.85f), new Vector2(2f, -2f));
				_subtitle = CreateText("Subtitle", val.transform, string.Empty, 15, (TextAnchor)5, new Color(0.78f, 0.8f, 0.82f, 0.92f));
				SetRect(((Component)_subtitle).gameObject, 44f, -68f, 44f, 42f, new Vector2(0f, 1f), new Vector2(1f, 1f));
				GameObject obj4 = CreateRect("HeaderLine", val.transform);
				SetRect(obj4, 44f, -74f, 44f, 71f, new Vector2(0f, 1f), new Vector2(1f, 1f));
				((Graphic)obj4.AddComponent<Image>()).color = new Color(0.82f, 0.84f, 0.86f, 0.14f);
				GameObject val2 = CreateRect("Viewport", val.transform);
				SetRect(val2, 40f, 34f, 40f, 82f, Vector2.zero, Vector2.one);
				((Graphic)val2.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.12f);
				val2.AddComponent<Mask>().showMaskGraphic = false;
				GameObject val3 = CreateRect("Content", val2.transform);
				_content = val3.GetComponent<RectTransform>();
				_content.anchorMin = new Vector2(0f, 1f);
				_content.anchorMax = new Vector2(1f, 1f);
				_content.pivot = new Vector2(0.5f, 1f);
				_content.offsetMin = Vector2.zero;
				_content.offsetMax = Vector2.zero;
				ScrollRect obj5 = val2.AddComponent<ScrollRect>();
				obj5.content = _content;
				obj5.viewport = val2.GetComponent<RectTransform>();
				obj5.horizontal = false;
				obj5.vertical = true;
				obj5.movementType = (MovementType)2;
				obj5.scrollSensitivity = 34f;
				CreateViewportDecorations(val2.transform);
				_root.SetActive(false);
			}
		}

		public void Show(ScoreboardSnapshot snapshot)
		{
			Create();
			_visibleSince = Time.unscaledTime;
			_snapshot = snapshot.Clone();
			Rebuild();
			GameObject root = _root;
			if ((Object)(object)root != (Object)null)
			{
				root.SetActive(true);
			}
		}

		public void Hide()
		{
			GameObject root = _root;
			if ((Object)(object)root != (Object)null)
			{
				root.SetActive(false);
			}
		}

		public void Refresh(ScoreboardSnapshot snapshot)
		{
			_snapshot = snapshot.Clone();
			if (Visible)
			{
				Rebuild();
			}
		}

		public void Tick()
		{
			if (Input.GetKeyDown((KeyCode)27))
			{
				Hide();
				return;
			}
			ScoreboardSnapshot scoreboardSnapshot = _snapshotProvider();
			if (scoreboardSnapshot.Timestamp != _snapshot.Timestamp || scoreboardSnapshot.Players.Count != _snapshot.Players.Count || scoreboardSnapshot.IsHostAuthoritative != _snapshot.IsHostAuthoritative)
			{
				Refresh(scoreboardSnapshot);
			}
			Animate(Time.unscaledTime);
		}

		private void Rebuild()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)_content == (Object)null)
			{
				return;
			}
			ClearContent();
			_highlightTexts.Clear();
			_highlightBackplates.Clear();
			if ((Object)_title != (Object)null)
			{
				_title.text = ScoreboardLocalization.Title;
			}
			if ((Object)_subtitle != (Object)null)
			{
				_subtitle.text = "Kain的进阶计分板 Kain Advanced Scoreboard";
			}
			List<PlayerScoreStats> list = ((_snapshot.Players.Count == 0) ? new List<PlayerScoreStats>
			{
				new PlayerScoreStats
				{
					PlayerName = ScoreboardLocalization.NoStats,
					PlayerSlot = 0
				}
			} : (from player in _snapshot.Players
				orderby (player.PlayerSlot < 0) ? int.MaxValue : player.PlayerSlot, player.PlayerId
				select player).Take(4).ToList());
			IReadOnlyList<ScoreRow> readOnlyList = BuildRows(_snapshot.HasObjectivePickups);
			float num = 42f + (float)readOnlyList.Count * 30f + 10f;
			_content.sizeDelta = new Vector2(0f, num);
			int num2 = Mathf.Max(1, list.Count);
			float centerWidthPixels = 260f;
			float sideGapPixels = 14f;
			float playerWidth = (1f - CenterWidthRatio(centerWidthPixels, num2, sideGapPixels)) / (float)num2;
			float num3 = 0.5f - CenterWidthRatio(centerWidthPixels, num2, sideGapPixels) * 0.5f;
			float num4 = 0.5f + CenterWidthRatio(centerWidthPixels, num2, sideGapPixels) * 0.5f;
			CreateCenterHeader(num3, num4);
			for (int num5 = 0; num5 < list.Count; num5++)
			{
				(float, float) tuple = CalculatePlayerColumnAnchor(num5, num2, playerWidth, num3, num4);
				CreatePlayerHeader(list[num5], tuple.Item1, tuple.Item2);
			}
			for (int num6 = 0; num6 < readOnlyList.Count; num6++)
			{
				float yTop = -42f - (float)num6 * 30f;
				CreateMetricCell(readOnlyList[num6].Label, num3, num4, yTop, center: true);
				for (int num7 = 0; num7 < list.Count; num7++)
				{
					(float, float) tuple2 = CalculatePlayerColumnAnchor(num7, num2, playerWidth, num3, num4);
					string value = readOnlyList[num6].Value(list[num7]);
					CreateValueCell(value, tuple2.Item1, tuple2.Item2, yTop, IsHighlighted(readOnlyList[num6], list[num7]));
				}
			}
		}

		private static float CenterWidthRatio(float centerWidthPixels, int playerCount, float sideGapPixels)
		{
			float num = 2200f;
			float num2 = ((playerCount <= 2) ? 0.22f : 0.18f);
			return Mathf.Clamp((centerWidthPixels + sideGapPixels * 2f) / num, num2, 0.26f);
		}

		private static (float Min, float Max) CalculatePlayerColumnAnchor(int playerIndex, int playerCount, float playerWidth, float centerMin, float centerMax)
		{
			int num = Mathf.CeilToInt((float)playerCount / 2f);
			if (playerIndex < num)
			{
				float num2 = centerMin / (float)num;
				return (Min: (float)playerIndex * num2 + 0.006f, Max: (float)(playerIndex + 1) * num2 - 0.006f);
			}
			int num3 = playerCount - num;
			if (num3 <= 0)
			{
				return (Min: 0.74f, Max: 0.99f);
			}
			int num4 = playerIndex - num;
			float num5 = (1f - centerMax) / (float)num3;
			return (Min: centerMax + (float)num4 * num5 + 0.006f, Max: centerMax + (float)(num4 + 1) * num5 - 0.006f);
		}

		private void CreateCenterHeader(float anchorMinX, float anchorMaxX)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0042: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateRect("MetricHeader", (Transform)_content);
			SetCellRect(val, anchorMinX, anchorMaxX, 0f, 42f);
			((Graphic)val.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.42f);
			AddInsetOutline(val, new Color(0.76f, 0.78f, 0.8f, 0.14f));
			Text obj = CreateText("MetricHeaderText", val.transform, ScoreboardLocalization.Title, 16, (TextAnchor)4, new Color(1f, 0.88f, 0.55f, 1f));
			Stretch(((Component)obj).gameObject, 4f, 0f, 4f, 0f);
			AddShadow(obj, new Color(0f, 0f, 0f, 0.85f), new Vector2(1f, -1f));
		}

		private void CreatePlayerHeader(PlayerScoreStats player, float anchorMinX, float anchorMaxX)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0042: 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_0096: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateRect("PlayerHeader", (Transform)_content);
			SetCellRect(val, anchorMinX, anchorMaxX, 0f, 42f);
			((Graphic)val.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.38f);
			AddInsetOutline(val, new Color(0.76f, 0.78f, 0.8f, 0.12f));
			string text = (string.IsNullOrWhiteSpace(player.PlayerName) ? "Player" : player.PlayerName);
			Text obj = CreateText("PlayerHeaderText", val.transform, text, 16, (TextAnchor)4, Color.white);
			Stretch(((Component)obj).gameObject, 8f, 0f, 8f, 0f);
			AddShadow(obj, new Color(0f, 0f, 0f, 0.9f), new Vector2(1f, -1f));
		}

		private void CreateMetricCell(string label, float anchorMinX, float anchorMaxX, float yTop, bool center)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateRect("MetricCell", (Transform)_content);
			SetCellRect(val, anchorMinX, anchorMaxX, yTop, 30f);
			((Graphic)val.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.44f);
			AddCellDivider(val.transform);
			Text obj = CreateText("MetricText", val.transform, ScoreboardLocalization.Upper(label), 14, (TextAnchor)(center ? 4 : 3), new Color(0.88f, 0.9f, 0.82f, 1f));
			Stretch(((Component)obj).gameObject, 8f, 0f, 8f, 0f);
			AddShadow(obj, new Color(0f, 0f, 0f, 0.85f), new Vector2(1f, -1f));
		}

		private void CreateValueCell(string value, float anchorMinX, float anchorMaxX, float yTop, bool highlighted)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0060: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: 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_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateRect("ValueCell", (Transform)_content);
			SetCellRect(val, anchorMinX, anchorMaxX, yTop, 30f);
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = (highlighted ? new Color(0.08f, 0.075f, 0.055f, 0.44f) : new Color(0f, 0f, 0f, 0.28f));
			AddCellDivider(val.transform);
			if (highlighted)
			{
				_highlightBackplates.Add(val2);
				GameObject obj = CreateRect("HighlightStrip", val.transform);
				SetRect(obj, 0f, 0f, 0f, 0f, new Vector2(0f, 0f), new Vector2(0f, 1f));
				obj.GetComponent<RectTransform>().sizeDelta = new Vector2(3f, 0f);
				((Graphic)obj.AddComponent<Image>()).color = new Color(1f, 0.76f, 0.32f, 0.72f);
			}
			Color color = (highlighted ? new Color(1f, 0.84f, 0.44f, 1f) : new Color(0.86f, 0.87f, 0.84f, 1f));
			Text val3 = CreateText("ValueText", val.transform, value, 16, (TextAnchor)4, color);
			Stretch(((Component)val3).gameObject, 4f, 0f, 4f, 0f);
			AddShadow(val3, new Color(0f, 0f, 0f, 0.88f), new Vector2(1f, -1f));
			if (highlighted)
			{
				_highlightTexts.Add(val3);
			}
		}

		private static bool IsHighlighted(ScoreRow row, PlayerScoreStats player)
		{
			if (row.Highlight != null)
			{
				return row.Highlight(player);
			}
			return false;
		}

		private void CreateFrameDecorations(Transform frame)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = CreateRect("TopGlow", frame);
			SetRect(obj, 42f, -6f, 42f, 0f, new Vector2(0f, 1f), new Vector2(1f, 1f));
			((Graphic)obj.AddComponent<Image>()).color = new Color(0.9f, 0.92f, 0.94f, 0.08f);
			GameObject obj2 = CreateRect("BottomGlow", frame);
			SetRect(obj2, 42f, 0f, 42f, 6f, Vector2.zero, new Vector2(1f, 0f));
			((Graphic)obj2.AddComponent<Image>()).color = new Color(0.9f, 0.92f, 0.94f, 0.05f);
			CreateCorner(frame, "TopLeftCorner", 28f, -28f, new Vector2(0f, 1f), left: true, top: true);
			CreateCorner(frame, "TopRightCorner", -28f, -28f, new Vector2(1f, 1f), left: false, top: true);
			CreateCorner(frame, "BottomLeftCorner", 28f, 28f, new Vector2(0f, 0f), left: true, top: false);
			CreateCorner(frame, "BottomRightCorner", -28f, 28f, new Vector2(1f, 0f), left: false, top: false);
			for (int i = 0; i < 7; i++)
			{
				GameObject obj3 = CreateRect("TopTick" + i.ToString(CultureInfo.InvariantCulture), frame);
				float num = 0.17f + (float)i * 0.11f;
				obj3.GetComponent<RectTransform>().anchorMin = new Vector2(num, 1f);
				obj3.GetComponent<RectTransform>().anchorMax = new Vector2(num, 1f);
				obj3.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 1f);
				obj3.GetComponent<RectTransform>().sizeDelta = new Vector2(34f, 4f);
				obj3.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, -18f);
				((Graphic)obj3.AddComponent<Image>()).color = new Color(0.86f, 0.88f, 0.9f, 0.12f);
			}
		}

		private void CreateViewportDecorations(Transform viewport)
		{
			//IL_0026: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Expected O, but got Unknown
			//IL_0112: 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_013f: Expected O, but got Unknown
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: 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_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			_scanLine = CreateRect("ScanLine", viewport).GetComponent<RectTransform>();
			_scanLine.anchorMin = new Vector2(0f, 1f);
			_scanLine.anchorMax = new Vector2(1f, 1f);
			_scanLine.pivot = new Vector2(0.5f, 1f);
			_scanLine.offsetMin = new Vector2(0f, -7f);
			_scanLine.offsetMax = new Vector2(0f, 0f);
			_scanLineLayers.Clear();
			CreateScanLineLayer((Transform)_scanLine, "ScanLineDeep", 7f, new Color(0.02f, 0.08f, 0.32f, 0.12f));
			CreateScanLineLayer((Transform)_scanLine, "ScanLineMid", 3f, new Color(0.05f, 0.26f, 0.86f, 0.2f));
			CreateScanLineLayer((Transform)_scanLine, "ScanLineCore", 1f, new Color(0.32f, 0.7f, 1f, 0.42f));
			for (int i = 1; i < 8; i++)
			{
				GameObject obj = CreateRect("VerticalGuide" + i.ToString(CultureInfo.InvariantCulture), viewport);
				RectTransform component = obj.GetComponent<RectTransform>();
				float num = (float)i / 8f;
				component.anchorMin = new Vector2(num, 0f);
				component.anchorMax = new Vector2(num, 1f);
				component.pivot = new Vector2(0.5f, 0.5f);
				component.sizeDelta = new Vector2(1f, 0f);
				((Graphic)obj.AddComponent<Image>()).color = new Color(0.82f, 0.84f, 0.86f, 0.035f);
			}
		}

		private void CreateScanLineLayer(Transform parent, string name, float height, Color color)
		{
			//IL_0018: 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_0042: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = CreateRect(name, parent);
			RectTransform component = obj.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 0.5f);
			component.anchorMax = new Vector2(1f, 0.5f);
			component.pivot = new Vector2(0.5f, 0.5f);
			component.offsetMin = new Vector2(0f, (0f - height) * 0.5f);
			component.offsetMax = new Vector2(0f, height * 0.5f);
			Image val = obj.AddComponent<Image>();
			((Graphic)val).color = color;
			_scanLineLayers.Add(val);
		}

		private static void CreateCorner(Transform parent, string name, float x, float y, Vector2 anchor, bool left, bool top)
		{
			//IL_0018: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0122: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = CreateRect(name + "H", parent);
			RectTransform component = obj.GetComponent<RectTransform>();
			component.anchorMin = anchor;
			component.anchorMax = anchor;
			component.pivot = new Vector2(left ? 0f : 1f, top ? 1f : 0f);
			component.sizeDelta = new Vector2(96f, 3f);
			component.anchoredPosition = new Vector2(x, y);
			((Graphic)obj.AddComponent<Image>()).color = new Color(0.86f, 0.88f, 0.9f, 0.22f);
			GameObject obj2 = CreateRect(name + "V", parent);
			RectTransform component2 = obj2.GetComponent<RectTransform>();
			component2.anchorMin = anchor;
			component2.anchorMax = anchor;
			component2.pivot = new Vector2(left ? 0f : 1f, top ? 1f : 0f);
			component2.sizeDelta = new Vector2(3f, 66f);
			component2.anchoredPosition = new Vector2(x, y);
			((Graphic)obj2.AddComponent<Image>()).color = new Color(0.86f, 0.88f, 0.9f, 0.22f);
		}

		private static void AddCellDivider(Transform parent)
		{
			//IL_0020: 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_0049: 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)
			GameObject obj = CreateRect("Divider", parent);
			SetRect(obj, 0f, 0f, 0f, 0f, Vector2.zero, new Vector2(1f, 0f));
			obj.GetComponent<RectTransform>().sizeDelta = new Vector2(0f, 1f);
			((Graphic)obj.AddComponent<Image>()).color = new Color(0.82f, 0.84f, 0.86f, 0.08f);
		}

		private static void AddInsetOutline(GameObject go, Color color)
		{
			//IL_0007: 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)
			Outline obj = go.AddComponent<Outline>();
			((Shadow)obj).effectColor = color;
			((Shadow)obj).effectDistance = new Vector2(1f, -1f);
		}

		private void Animate(float now)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_0096: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Expected O, but got Unknown
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Expected O, but got Unknown
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			float num = now - _visibleSince;
			float num2 = 0.5f + 0.5f * Mathf.Sin(num * 2.15f);
			if ((Object)_frameImage != (Object)null)
			{
				((Graphic)_frameImage).color = new Color(0f, 0f, 0f, 0.3f + num2 * 0.06f);
			}
			if ((Object)_frameOutline != (Object)null)
			{
				((Shadow)_frameOutline).effectColor = new Color(0.78f, 0.8f, 0.82f, 0.12f + num2 * 0.12f);
			}
			if ((Object)_scanLine != (Object)null)
			{
				float num3 = Mathf.PingPong(num * 58f, 560f);
				_scanLine.anchoredPosition = new Vector2(0f, 0f - num3);
			}
			for (int i = 0; i < _scanLineLayers.Count; i++)
			{
				if (!((Object)_scanLineLayers[i] == (Object)null))
				{
					switch (i)
					{
					case 0:
						((Graphic)_scanLineLayers[i]).color = new Color(0.02f, 0.08f, 0.32f, 0.08f + num2 * 0.08f);
						break;
					case 1:
						((Graphic)_scanLineLayers[i]).color = new Color(0.05f, 0.26f, 0.86f, 0.12f + num2 * 0.12f);
						break;
					default:
						((Graphic)_scanLineLayers[i]).color = new Color(0.32f, 0.7f, 1f, 0.24f + num2 * 0.22f);
						break;
					}
				}
			}
			Color color = default(Color);
			((Color)(ref color))..ctor(1f, 0.84f, 0.44f, 0.84f + num2 * 0.16f);
			for (int j = 0; j < _highlightTexts.Count; j++)
			{
				if ((Object)_highlightTexts[j] != (Object)null)
				{
					((Graphic)_highlightTexts[j]).color = color;
				}
			}
			Color color2 = default(Color);
			((Color)(ref color2))..ctor(0.08f + num2 * 0.015f, 0.075f + num2 * 0.012f, 0.055f, 0.28f + num2 * 0.12f);
			for (int k = 0; k < _highlightBackplates.Count; k++)
			{
				if ((Object)_highlightBackplates[k] != (Object)null)
				{
					((Graphic)_highlightBackplates[k]).color = color2;
				}
			}
		}

		private static IReadOnlyList<ScoreRow> BuildRows(bool showObjectivePickups)
		{
			return new List<ScoreRow>
			{
				new ScoreRow("total kills", "总击杀", (PlayerScoreStats p) => (p.SmallKills + p.LargeKills + p.ScoutKills + p.BossKills).ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.SmallKills + p.LargeKills + p.ScoutKills + p.BossKills > 0),
				new ScoreRow("small kills", "小型击杀", (PlayerScoreStats p) => p.SmallKills.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.SmallKills > 0),
				new ScoreRow("large kills", "大型击杀", (PlayerScoreStats p) => p.LargeKills.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.LargeKills > 0),
				new ScoreRow("scouts killed", "Scout 击杀", (PlayerScoreStats p) => p.ScoutKills.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.ScoutKills > 0),
				new ScoreRow("bosses killed", "Boss 击杀", (PlayerScoreStats p) => p.BossKills.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.BossKills > 0),
				new ScoreRow("melee kills", "近战击杀", (PlayerScoreStats p) => p.MeleeKills.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.MeleeKills > 0),
				new ScoreRow("tool kills", "工具击杀", (PlayerScoreStats p) => p.ToolKills.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.ToolKills > 0),
				new ScoreRow("stealth kills", "潜行击杀", (PlayerScoreStats p) => p.StealthKills.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.StealthKills > 0),
				new ScoreRow("damage dealt", "总伤害", (PlayerScoreStats p) => FormatNumber(p.TotalDamage), (PlayerScoreStats p) => p.TotalDamage > 0f),
				new ScoreRow("damage taken", "承受伤害", (PlayerScoreStats p) => FormatNumber(p.DamageTaken), (PlayerScoreStats p) => p.DamageTaken > 0f),
				new ScoreRow("primary shots", "主武器开火", (PlayerScoreStats p) => p.PrimaryWeapon.ShotsFired.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.PrimaryWeapon.ShotsFired > 0),
				new ScoreRow("primary hits", "主武器命中", (PlayerScoreStats p) => p.PrimaryWeapon.Hits.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.PrimaryWeapon.Hits > 0),
				new ScoreRow("primary weak hits", "主武器弱点", (PlayerScoreStats p) => p.PrimaryWeapon.WeakspotHits.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.PrimaryWeapon.WeakspotHits > 0),
				new ScoreRow("primary accuracy", "主武器命中率", (PlayerScoreStats p) => FormatPercent(p.PrimaryWeapon.HitRate), (PlayerScoreStats p) => p.PrimaryWeapon.HitRate > 0f),
				new ScoreRow("primary weak rate", "主武器弱点率", (PlayerScoreStats p) => FormatPercent(p.PrimaryWeapon.WeakspotRate), (PlayerScoreStats p) => p.PrimaryWeapon.WeakspotRate > 0f),
				new ScoreRow("secondary shots", "副武器开火", (PlayerScoreStats p) => p.SecondaryWeapon.ShotsFired.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.SecondaryWeapon.ShotsFired > 0),
				new ScoreRow("secondary hits", "副武器命中", (PlayerScoreStats p) => p.SecondaryWeapon.Hits.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.SecondaryWeapon.Hits > 0),
				new ScoreRow("secondary weak hits", "副武器弱点", (PlayerScoreStats p) => p.SecondaryWeapon.WeakspotHits.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.SecondaryWeapon.WeakspotHits > 0),
				new ScoreRow("secondary accuracy", "副武器命中率", (PlayerScoreStats p) => FormatPercent(p.SecondaryWeapon.HitRate), (PlayerScoreStats p) => p.SecondaryWeapon.HitRate > 0f),
				new ScoreRow("secondary weak rate", "副武器弱点率", (PlayerScoreStats p) => FormatPercent(p.SecondaryWeapon.WeakspotRate), (PlayerScoreStats p) => p.SecondaryWeapon.WeakspotRate > 0f),
				new ScoreRow("downs", "倒地次数", (PlayerScoreStats p) => p.DownedCount.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.DownedCount > 0),
				new ScoreRow("rescues", "救援次数", (PlayerScoreStats p) => p.RescueCount.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.RescueCount > 0),
				new ScoreRow("med packs received", "医疗包次数", (PlayerScoreStats p) => p.MedicalPacksReceived.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.MedicalPacksReceived > 0),
				new ScoreRow("ammo packs received", "弹药包次数", (PlayerScoreStats p) => p.AmmoPacksReceived.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.AmmoPacksReceived > 0),
				new ScoreRow("tool packs received", "工具包次数", (PlayerScoreStats p) => p.ToolPacksReceived.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.ToolPacksReceived > 0),
				new ScoreRow("disinfect packs received", "消毒包次数", (PlayerScoreStats p) => p.DisinfectionPacksReceived.ToString(CultureInfo.InvariantCulture), (PlayerScoreStats p) => p.DisinfectionPacksReceived > 0),
				new ScoreRow("damage per ammo pack", "每份弹药包伤害", (PlayerScoreStats p) => float.IsPositiveInfinity(p.DamagePerAmmoPack) ? ScoreboardLocalization.Pick("Infinity", "无穷大") : FormatNumber(p.DamagePerAmmoPack), (PlayerScoreStats p) => !float.IsPositiveInfinity(p.DamagePerAmmoPack) && p.DamagePerAmmoPack > 0f),
				new ScoreRow("scan participation", "扫描参与时间", (PlayerScoreStats p) => FormatSeconds(p.ScanParticipationSeconds), (PlayerScoreStats p) => p.ScanParticipationSeconds > 0f)
			};
		}

		private void ClearContent()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			if (!((Object)_content == (Object)null))
			{
				for (int num = ((Transform)_content).childCount - 1; num >= 0; num--)
				{
					Object.Destroy((Object)((Component)((Transform)_content).GetChild(num)).gameObject);
				}
			}
		}

		private Text CreateText(string name, Transform parent, string text, int fontSize, TextAnchor alignment, Color color)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			Text obj = CreateRect(name, parent).AddComponent<Text>();
			obj.font = _font ?? Resources.GetBuiltinResource<Font>("Arial.ttf");
			obj.fontSize = fontSize;
			obj.text = text;
			obj.alignment = alignment;
			((Graphic)obj).color = color;
			obj.horizontalOverflow = (HorizontalWrapMode)0;
			obj.verticalOverflow = (VerticalWrapMode)0;
			obj.supportRichText = false;
			((Graphic)obj).raycastTarget = false;
			return obj;
		}

		private static GameObject CreateRect(string name, Transform parent)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			val.AddComponent<RectTransform>();
			return val;
		}

		private static void Stretch(GameObject go, float left, float bottom, float right, float top)
		{
			//IL_0007: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = go.GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			component.offsetMin = new Vector2(left, bottom);
			component.offsetMax = new Vector2(0f - right, 0f - top);
		}

		private static void SetRect(GameObject go, float left, float bottom, float right, float top, Vector2 anchorMin, Vector2 anchorMax)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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)
			RectTransform component = go.GetComponent<RectTransform>();
			component.anchorMin = anchorMin;
			component.anchorMax = anchorMax;
			component.offsetMin = new Vector2(left, bottom);
			component.offsetMax = new Vector2(0f - right, 0f - top);
		}

		private static void SetCellRect(GameObject go, float anchorMinX, float anchorMaxX, float yTop, float height)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = go.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(anchorMinX, 1f);
			component.anchorMax = new Vector2(anchorMaxX, 1f);
			component.pivot = new Vector2(0.5f, 1f);
			component.offsetMin = new Vector2(0f, yTop - height);
			component.offsetMax = new Vector2(0f, yTop);
		}

		private static void AddShadow(Text text, Color color, Vector2 distance)
		{
			//IL_000c: 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)
			Shadow obj = ((Component)text).gameObject.AddComponent<Shadow>();
			obj.effectColor = color;
			obj.effectDistance = distance;
		}

		private static string FormatNumber(float value)
		{
			if (!(value >= 100000f))
			{
				if (!(value >= 1000f))
				{
					return value.ToString("0.#", CultureInfo.InvariantCulture);
				}
				return value.ToString("0", CultureInfo.InvariantCulture);
			}
			return (value / 1000f).ToString("0.#", CultureInfo.InvariantCulture) + "K";
		}

		private static string FormatPercent(float value)
		{
			return (value * 100f).ToString("0.#", CultureInfo.InvariantCulture) + "%";
		}

		private static string FormatSeconds(float value)
		{
			return value.ToString("0.0", CultureInfo.InvariantCulture) + "s";
		}
	}
}
namespace KainAdvancedScoreboard.Runtime
{
	public enum DamageSourceType
	{
		Unknown,
		PrimaryWeapon,
		SecondaryWeapon,
		Melee,
		Tool
	}
	public sealed class EnemyAttribution
	{
		public ulong LastDamageDealer { get; set; }

		public float LastDamageTime { get; set; }

		public DamageSourceType LastDamageSource { get; set; }

		public bool LastDamageWasWeakspot { get; set; }

		public bool LastDamageWasMelee { get; set; }

		public bool LastDamageWasSleepingTarget { get; set; }

		public ulong LastTaggedBy { get; set; }

		public float LastTaggedTime { get; set; }

		public ulong LastFoamedBy { get; set; }

		public float LastFoamedTime { get; set; }

		public float LastKnownHealthMax { get; set; }

		public uint EnemyDataId { get; set; }

		public bool IsScout { get; set; }

		public ulong LastCountedDamageDealer { get; set; }

		public float LastCountedDamageTime { get; set; }

		public float LastCountedDamageAmount { get; set; }
	}
	public sealed class PlayerScoreStats
	{
		public ulong PlayerId { get; set; }

		public string PlayerName { get; set; } = string.Empty;

		public int PlayerSlot { get; set; } = -1;

		public ulong SteamId { get; set; }

		public int SmallKills { get; set; }

		public int LargeKills { get; set; }

		public int ScoutKills { get; set; }

		public int BossKills { get; set; }

		public float TotalDamage { get; set; }

		public WeaponScoreStats PrimaryWeapon { get; set; } = new WeaponScoreStats();

		public WeaponScoreStats SecondaryWeapon { get; set; } = new WeaponScoreStats();

		public float DamageTaken { get; set; }

		public int DownedCount { get; set; }

		public int RescueCount { get; set; }

		public int MedicalPacksReceived { get; set; }

		public int AmmoPacksReceived { get; set; }

		public int ToolPacksReceived { get; set; }

		public int DisinfectionPacksReceived { get; set; }

		public int ObjectivePickups { get; set; }

		public int TerminalCommands { get; set; }

		public int MeleeKills { get; set; }

		public int ToolKills { get; set; }

		public int BioTrackerTaggedEnemies { get; set; }

		public float ScanParticipationSeconds { get; set; }

		public int StealthKills { get; set; }

		public float DamagePerAmmoPack
		{
			get
			{
				if (AmmoPacksReceived > 0)
				{
					return TotalDamage / (float)AmmoPacksReceived;
				}
				return float.PositiveInfinity;
			}
		}

		public PlayerScoreStats Clone()
		{
			return new PlayerScoreStats
			{
				PlayerId = PlayerId,
				PlayerName = PlayerName,
				PlayerSlot = PlayerSlot,
				SteamId = SteamId,
				SmallKills = SmallKills,
				LargeKills = LargeKills,
				ScoutKills = ScoutKills,
				BossKills = BossKills,
				TotalDamage = TotalDamage,
				PrimaryWeapon = PrimaryWeapon.Clone(),
				SecondaryWeapon = SecondaryWeapon.Clone(),
				DamageTaken = DamageTaken,
				DownedCount = DownedCount,
				RescueCount = RescueCount,
				MedicalPacksReceived = MedicalPacksReceived,
				AmmoPacksReceived = AmmoPacksReceived,
				ToolPacksReceived = ToolPacksReceived,
				DisinfectionPacksReceived = DisinfectionPacksReceived,
				ObjectivePickups = ObjectivePickups,
				TerminalCommands = TerminalCommands,
				MeleeKills = MeleeKills,
				ToolKills = ToolKills,
				BioTrackerTaggedEnemies = BioTrackerTaggedEnemies,
				ScanParticipationSeconds = ScanParticipationSeconds,
				StealthKills = StealthKills
			};
		}

		public void MergeMax(PlayerScoreStats other)
		{
			if (string.IsNullOrWhiteSpace(PlayerName))
			{
				PlayerName = other.PlayerName;
			}
			if (PlayerSlot < 0)
			{
				PlayerSlot = other.PlayerSlot;
			}
			if (SteamId == 0L)
			{
				SteamId = other.SteamId;
			}
			SmallKills = Math.Max(SmallKills, other.SmallKills);
			LargeKills = Math.Max(LargeKills, other.LargeKills);
			ScoutKills = Math.Max(ScoutKills, other.ScoutKills);
			BossKills = Math.Max(BossKills, other.BossKills);
			TotalDamage = Math.Max(TotalDamage, other.TotalDamage);
			PrimaryWeapon.MergeMax(other.PrimaryWeapon);
			SecondaryWeapon.MergeMax(other.SecondaryWeapon);
			DamageTaken = Math.Max(DamageTaken, other.DamageTaken);
			DownedCount = Math.Max(DownedCount, other.DownedCount);
			RescueCount = Math.Max(RescueCount, other.RescueCount);
			MedicalPacksReceived = Math.Max(MedicalPacksReceived, other.MedicalPacksReceived);
			AmmoPacksReceived = Math.Max(AmmoPacksReceived, other.AmmoPacksReceived);
			ToolPacksReceived = Math.Max(ToolPacksReceived, other.ToolPacksReceived);
			DisinfectionPacksReceived = Math.Max(DisinfectionPacksReceived, other.DisinfectionPacksReceived);
			ObjectivePickups = Math.Max(ObjectivePickups, other.ObjectivePickups);
			TerminalCommands = Math.Max(TerminalCommands, other.TerminalCommands);
			MeleeKills = Math.Max(MeleeKills, other.MeleeKills);
			ToolKills = Math.Max(ToolKills, other.ToolKills);
			BioTrackerTaggedEnemies = Math.Max(BioTrackerTaggedEnemies, other.BioTrackerTaggedEnemies);
			ScanParticipationSeconds = Math.Max(ScanParticipationSeconds, other.ScanParticipationSeconds);
			StealthKills = Math.Max(StealthKills, other.StealthKills);
		}
	}
	public enum ResourcePackKind
	{
		Medical,
		Ammo,
		Tool,
		Disinfection
	}
	public sealed class ScoreboardNativeCallbacks
	{
		private readonly ScoreboardRuntime _runtime;

		private bool _installed;

		private Action<EnemyDamageInfo>? _enemyDamaged;

		private Action<EnemyDamageInfo>? _enemyKilled;

		private Action<PlayerDamageInfo>? _playerDamaged;

		private Action<PlayerAgent>? _playerDowned;

		private Action<PlayerAgent>? _playerShotWeapon;

		private Action<PlayerAgent, InventorySlot>? _playerActivatedTool;

		private Action<PlayerAgent, bool>? _playerUsedFlashlight;

		private Action<PlayerAgent, iResourcePackReceiver, eResourceContainerSpawnType>? _playerUsedResource;

		private Action? _playerUsedDisinfectionStation;

		private Action<PlayerAgent, eDimensionIndex, eDimensionIndex>? _playerTeleported;

		private Action<RundownDataBlock, eRundownTier, int, ExpeditionEndState>? _expeditionComplete;

		private Action<pLogRead>? _readLog;

		public ScoreboardNativeCallbacks(ScoreboardRuntime runtime)
		{
			_runtime = runtime;
		}

		public void Install()
		{
			if (!_installed)
			{
				_enemyDamaged = _runtime.OnNativeEnemyDamaged;
				_enemyKilled = _runtime.OnNativeEnemyKilled;
				_playerDamaged = _runtime.OnNativePlayerDamaged;
				_playerDowned = _runtime.OnNativePlayerDowned;
				_playerShotWeapon = _runtime.OnNativePlayerShotWeapon;
				_playerActivatedTool = _runtime.OnNativePlayerActivatedTool;
				_playerUsedFlashlight = _runtime.OnNativePlayerUsedFlashlight;
				_playerUsedResource = _runtime.OnNativePlayerUsedResource;
				_playerUsedDisinfectionStation = _runtime.OnNativePlayerUsedDisinfectionStation;
				_playerTeleported = _runtime.OnNativePlayerTeleported;
				_expeditionComplete = _runtime.OnNativeExpeditionComplete;
				_readLog = _runtime.OnNativeReadLog;
				GlobalCallbacks.OnEnemyDamagedMaster += Action<EnemyDamageInfo>.op_Implicit(_enemyDamaged);
				GlobalCallbacks.OnEnemyKilledMaster += Action<EnemyDamageInfo>.op_Implicit(_enemyKilled);
				GlobalCallbacks.OnPlayerDamaged += Action<PlayerDamageInfo>.op_Implicit(_playerDamaged);
				GlobalCallbacks.OnPlayerDowned += Action<PlayerAgent>.op_Implicit(_playerDowned);
				GlobalCallbacks.OnPlayerShotWeapon += Action<PlayerAgent>.op_Implicit(_playerShotWeapon);
				GlobalCallbacks.OnPlayerActivatedTool += Action<PlayerAgent, InventorySlot>.op_Implicit(_playerActivatedTool);
				GlobalCallbacks.OnPlayerUsedFlashlight += Action<PlayerAgent, bool>.op_Implicit(_playerUsedFlashlight);
				GlobalCallbacks.OnPlayerUsedResource += Action<PlayerAgent, iResourcePackReceiver, eResourceContainerSpawnType>.op_Implicit(_playerUsedResource);
				GlobalCallbacks.OnPlayerUsedDisinfectionStation += Action.op_Implicit(_playerUsedDisinfectionStation);
				GlobalCallbacks.OnPlayerTeleported += Action<PlayerAgent, eDimensionIndex, eDimensionIndex>.op_Implicit(_playerTeleported);
				GlobalCallbacks.OnExpeditionComplete += Action<RundownDataBlock, eRundownTier, int, ExpeditionEndState>.op_Implicit(_expeditionComplete);
				GlobalCallbacks.OnReadLog += Action<pLogRead>.op_Implicit(_readLog);
				_installed = true;
			}
		}
	}
	public sealed class ScoreboardRuntime
	{
		private readonly Func<bool> _verboseEventLog;

		private readonly Dictionary<ulong, PlayerScoreStats> _statsByPlayer = new Dictionary<ulong, PlayerScoreStats>();

		private readonly Dictionary<int, PlayerAgent> _playersByAgentId = new Dictionary<int, PlayerAgent>();

		private readonly Dictionary<int, PlayerAgent> _playersByUnityId = new Dictionary<int, PlayerAgent>();

		private readonly Dictionary<IntPtr, EnemyAttribution> _enemyAttribution = new Dictionary<IntPtr, EnemyAttribution>();

		private readonly Dictionary<int, PlayerAgent> _reviveTargetsByInteraction = new Dictionary<int, PlayerAgent>();

		private readonly Dictionary<ulong, bool> _downStateByPlayer = new Dictionary<ulong, bool>();

		private readonly Dictionary<int, float> _nextBioscanSampleByCore = new Dictionary<int, float>();

		private readonly Dictionary<ulong, int> _remoteShotBufferByPlayer = new Dictionary<ulong, int>();

		private readonly Dictionary<ulong, float> _peerSnapshotSeenAtByPlayer = new Dictionary<ulong, float>();

		private readonly Dictionary<ulong, float> _lastDamageTakenAt = new Dictionary<ulong, float>();

		private readonly Dictionary<ulong, float> _lastDamageTakenAmount = new Dictionary<ulong, float>();

		private readonly Dictionary<string, float> _lastResourceReceivedAt = new Dictionary<string, float>(StringComparer.Ordinal);

		private readonly Dictionary<string, float> _lastReviveCompletedAt = new Dictionary<string, float>(StringComparer.Ordinal);

		private readonly HashSet<int> _countedTerminalCommands = new HashSet<int>();

		private readonly HashSet<int> _countedObjectivePickups = new HashSet<int>();

		private readonly HashSet<string> _countedBioTags = new HashSet<string>(StringComparer.Ordinal);

		private ScoreboardSnapshot _hostSnapshot = ScoreboardSnapshot.Empty.Clone();

		private bool _expeditionEnded;

		private bool _hasObjectivePickups;

		private ulong _localPlayerId;

		private float _nextLifeStateSampleAt;

		public bool IsHostAuthority
		{
			get
			{
				try
				{
					return !SNet.IsOnline || !SNet.HasMaster || SNet.IsMaster;
				}
				catch
				{
					return true;
				}
			}
		}

		public ScoreboardRuntime(Func<bool> verboseEventLog)
		{
			_verboseEventLog = verboseEventLog;
		}

		public void ResetForNewExpedition()
		{
			_statsByPlayer.Clear();
			_playersByAgentId.Clear();
			_playersByUnityId.Clear();
			_enemyAttribution.Clear();
			_reviveTargetsByInteraction.Clear();
			_downStateByPlayer.Clear();
			_nextBioscanSampleByCore.Clear();
			_remoteShotBufferByPlayer.Clear();
			_peerSnapshotSeenAtByPlayer.Clear();
			_lastDamageTakenAt.Clear();
			_lastDamageTakenAmount.Clear();
			_lastResourceReceivedAt.Clear();
			_lastReviveCompletedAt.Clear();
			_countedTerminalCommands.Clear();
			_countedObjectivePickups.Clear();
			_countedBioTags.Clear();
			_hostSnapshot = ScoreboardSnapshot.Empty.Clone();
			_expeditionEnded = false;
			_hasObjectivePickups = false;
			_localPlayerId = 0uL;
			_nextLifeStateSampleAt = 0f;
			TryRegisterLocalPlayer();
		}

		public void MarkExpeditionEnded()
		{
			_expeditionEnded = true;
		}

		public void SamplePlayerLifeStates()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			float time = Time.time;
			if (time < _nextLifeStateSampleAt)
			{
				return;
			}
			_nextLifeStateSampleAt = time + 0.25f;
			TryRegisterLocalPlayer();
			TryRegisterPlayersInSlots();
			HashSet<ulong> hashSet = new HashSet<ulong>();
			foreach (PlayerAgent item in new List<PlayerAgent>(_playersByUnityId.Values))
			{
				if ((Object)item == (Object)null || !ShouldCollectSharedMetric(item))
				{
					continue;
				}
				RegisterPlayer(item);
				ulong playerId = GetPlayerId(item);
				if (!hashSet.Add(playerId))
				{
					continue;
				}
				bool flag = IsPlayerDown(item);
				if (!_downStateByPlayer.TryGetValue(playerId, out var value))
				{
					_downStateByPlayer[playerId] = flag;
					if (flag)
					{
						GetOrCreateStats(playerId).DownedCount++;
					}
				}
				else
				{
					if (flag && !value)
					{
						GetOrCreateStats(playerId).DownedCount++;
					}
					_downStateByPlayer[playerId] = flag;
				}
			}
		}

		public void RegisterPlayer(PlayerAgent? player)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			if (!((Object)player == (Object)null))
			{
				ulong playerId = GetPlayerId(player);
				if (IsLocalHumanPlayer(player))
				{
					_localPlayerId = playerId;
				}
				PlayerScoreStats orCreateStats = GetOrCreateStats(playerId);
				orCreateStats.PlayerSlot = SafePlayerSlot(player);
				orCreateStats.PlayerName = SafePlayerName(player, orCreateStats.PlayerName);
				orCreateStats.SteamId = SafeSteamId(player);
				if (((Agent)player).GameObjectID > 0)
				{
					_playersByAgentId[((Agent)player).GameObjectID] = player;
				}
				int instanceID = ((Object)player).GetInstanceID();
				if (instanceID != 0)
				{
					_playersByUnityId[instanceID] = player;
				}
			}
		}

		public void OnBulletWeaponFired(BulletWeapon? weapon)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			if (!((Object)weapon == (Object)null))
			{
				PlayerAgent val = ResolvePlayerFromObject(weapon);
				if ((Object)val == (Object)null)
				{
					val = TryGetLocalPlayer();
				}
				if (!((Object)val == (Object)null) && ShouldCollectPeerOwnedMetric(val))
				{
					RegisterPlayer(val);
					CountWeaponShots(GetPlayerId(val), ResolveWeaponSlot(weapon), ResolveProjectileCountPerShot(val));
				}
			}
		}

		public void OnEnemyDamaged(Dam_EnemyDamageBase? damageBase, Agent? sourceAgent, float damage, int limbId, bool isMelee, bool wasSleepingTarget)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			if (!((Object)damageBase == (Object)null))
			{
				CountReceivedEnemyDamage(damageBase, sourceAgent, damage, limbId, isMelee ? DamageSourceType.Melee : DamageSourceType.Unknown, isMelee, wasSleepingTarget);
			}
		}

		public void OnEnemyBulletDamageReceived(Dam_EnemyDamageBase? damageBase, pBulletDamageData data)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//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_002d: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)damageBase == (Object)null))
			{
				CountReceivedEnemyDamage(damageBase, ResolveAgent(data.source), ((UFloat16)(ref data.damage)).Get(((Dam_SyncedDamageBase)damageBase).HealthMax), data.limbID, DamageSourceType.Unknown, isMelee: false, wasSleepingTarget: false);
			}
		}

		public void OnEnemyMeleeDamageReceived(Dam_EnemyDamageBase? damageBase, pFullDamageData data)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//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_002d: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)damageBase == (Object)null))
			{
				CountReceivedEnemyDamage(damageBase, ResolveAgent(data.source), ((UFloat16)(ref data.damage)).Get(((Dam_SyncedDamageBase)damageBase).HealthMax), data.limbID, DamageSourceType.Melee, isMelee: true, wasSleepingTarget: false);
			}
		}

		public void OnEnemyTakeDamage(EnemyAgent? enemy, float damage, Agent? sourceAgent)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			if (!((Object)enemy == (Object)null) && !((Object)enemy.Damage == (Object)null))
			{
				CountReceivedEnemyDamage(enemy.Damage, sourceAgent, damage, -1, ResolveDamageSourceType(ResolvePlayer(sourceAgent), sourceAgent), isMelee: false, IsEnemySleeping(enemy));
			}
		}

		public void OnSyncedBulletsFired(PlayerSync? sync, int count)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			if (!((Object)sync == (Object)null) && count > 0)
			{
				PlayerAgent val = ResolvePlayerFromObject(sync);
				if ((Object)val == (Object)null)
				{
					val = TryGetLocalPlayer();
				}
				if (!((Object)val == (Object)null) && ShouldCollectPeerOwnedMetric(val))
				{
					RegisterPlayer(val);
					CountWeaponShots(GetPlayerId(val), ResolveWeaponSlot(val), AdjustSyncedShotCountForWeapon(val, count));
				}
			}
		}

		public void OnPlayerInventorySyncedGetSync(PlayerInventorySynced? inventory)
		{
		}

		public void OnEnemyDead(EnemyAgent? enemy)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			if (!((Object)enemy == (Object)null))
			{
				IntPtr enemyKey = GetEnemyKey(enemy, enemy.Damage);
				if (enemyKey != IntPtr.Zero && _enemyAttribution.TryGetValue(enemyKey, out EnemyAttribution value))
				{
					CountKillFromAttribution(enemy, enemy.Damage, value);
					_enemyAttribution.Remove(enemyKey);
				}
			}
		}

		public void OnEnemyTagged(EnemyAgent? enemy)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			if ((Object)enemy == (Object)null)
			{
				return;
			}
			PlayerAgent val = TryGetLocalPlayer();
			if ((Object)val == (Object)null)
			{
				val = TryGetSingleKnownPlayer();
			}
			if (!((Object)val == (Object)null))
			{
				RegisterPlayer(val);
				ulong playerId = GetPlayerId(val);
				IntPtr enemyKey = GetEnemyKey(enemy, enemy.Damage);
				if (enemyKey != IntPtr.Zero)
				{
					EnemyAttribution orCreateAttribution = GetOrCreateAttribution(enemyKey);
					orCreateAttribution.LastTaggedBy = playerId;
					orCreateAttribution.LastTaggedTime = Time.time;
				}
				string item = playerId.ToString(CultureInfo.InvariantCulture) + ":" + enemyKey.ToInt64().ToString(CultureInfo.InvariantCulture);
				if (_countedBioTags.Add(item))
				{
					GetOrCreateStats(playerId).BioTrackerTaggedEnemies++;
				}
			}
		}

		public void OnPlayerDamage(PlayerAgent? player, float damage, string reason)
		{
		}

		public void OnIncomingPlayerDamage(PlayerAgent? player, float damage, float originalDamage, Agent? sourceAgent)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			if (!((Object)player == (Object)null) && ShouldCollectSharedMetric(player))
			{
				float amount = Mathf.Max(damage, originalDamage);
				CountDamageTaken(player, amount);
			}
		}

		public void OnResourceReceived(PlayerAgent? receiver, PlayerAgent? giver, ResourcePackKind kind)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			if ((Object)receiver == (Object)null || !ShouldCollectSharedMetric(receiver))
			{
				return;
			}
			RegisterPlayer(receiver);
			if ((Object)giver != (Object)null)
			{
				RegisterPlayer(giver);
			}
			PlayerScoreStats orCreateStats = GetOrCreateStats(GetPlayerId(receiver));
			ulong num = (((Object)giver != (Object)null) ? GetPlayerId(giver) : 0);
			string key = GetPlayerId(receiver).ToString(CultureInfo.InvariantCulture) + ":" + num.ToString(CultureInfo.InvariantCulture) + ":" + kind;
			float time = Time.time;
			if (!_lastResourceReceivedAt.TryGetValue(key, out var value) || !(time - value <= 0.1f))
			{
				_lastResourceReceivedAt[key] = time;
				switch (kind)
				{
				case ResourcePackKind.Medical:
					orCreateStats.MedicalPacksReceived++;
					break;
				case ResourcePackKind.Ammo:
					orCreateStats.AmmoPacksReceived++;
					break;
				case ResourcePackKind.Tool:
					orCreateStats.ToolPacksReceived++;
					break;
				case ResourcePackKind.Disinfection:
					orCreateStats.DisinfectionPacksReceived++;
					break;
				}
			}
		}

		public void OnNativeEnemyDamaged(EnemyDamageInfo? info)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			if (info == null || info.Damage <= 0f)
			{
				return;
			}
			EnemyAgent damagedAgent = info.DamagedAgent;
			Dam_EnemyDamageBase val = (((Object)(object)damagedAgent != (Object)null) ? damagedAgent.Damage : null);
			PlayerAgent val2 = ResolvePlayer(info.Source) ?? ResolvePlayerFromObject(info.Source);
			ulong num = (((Object)val2 != (Object)null) ? GetPlayerId(val2) : 0);
			DamageSourceType damageSourceType = ResolveNativeDamageSourceType(val2, info.Source, info.gearCategoryId);
			IntPtr enemyKey = GetEnemyKey(damagedAgent, val);
			EnemyAttribution enemyAttribution = ((enemyKey != IntPtr.Zero) ? GetOrCreateAttribution(enemyKey) : null);
			bool flag = (Object)val != (Object)null && IsWeakspotLimb(val, info.LimbID);
			bool flag2 = AchievementManager.IsMelee(info.gearCategoryId);
			bool flag3 = num != 0L && ShouldCollectSharedMetric(val2);
			if (flag3)
			{
				RegisterPlayer(val2);
				CountEnemyDamage(enemyAttribution, num, info.Damage, damageSourceType, flag, flag2);
			}
			if (enemyAttribution != null)
			{
				if (flag3)
				{
					enemyAttribution.LastDamageDealer = num;
					enemyAttribution.LastDamageTime = Time.time;
					enemyAttribution.LastDamageSource = damageSourceType;
					enemyAttribution.LastDamageWasWeakspot = flag;
					enemyAttribution.LastDamageWasMelee = flag2;
					enemyAttribution.LastDamageWasSleepingTarget = IsEnemySleeping(damagedAgent);
				}
				enemyAttribution.LastKnownHealthMax = Mathf.Max(enemyAttribution.LastKnownHealthMax, GetEnemyMaxHealth(damagedAgent, val));
				enemyAttribution.EnemyDataId = SafeEnemyDataId(damagedAgent);
				enemyAttribution.IsScout |= IsScout(damagedAgent);
			}
		}

		public void OnNativeEnemyKilled(EnemyDamageInfo? info)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			if (info == null)
			{
				return;
			}
			EnemyAgent damagedAgent = info.DamagedAgent;
			Dam_EnemyDamageBase damageBase = (((Object)(object)damagedAgent != (Object)null) ? damagedAgent.Damage : null);
			PlayerAgent val = ResolvePlayer(info.Source) ?? ResolvePlayerFromObject(info.Source);
			ulong num = (((Object)val != (Object)null) ? GetPlayerId(val) : 0);
			DamageSourceType damageSourceType = ResolveNativeDamageSourceType(val, info.Source, info.gearCategoryId);
			bool flag = AchievementManager.IsMelee(info.gearCategoryId);
			IntPtr enemyKey = GetEnemyKey(damagedAgent, damageBase);
			if (num == 0L && enemyKey != IntPtr.Zero && _enemyAttribution.TryGetValue(enemyKey, out EnemyAttribution value))
			{
				num = value.LastDamageDealer;
				damageSourceType = value.LastDamageSource;
				flag = value.LastDamageWasMelee;
			}
			try
			{
				if (num != 0L && (Object)val != (Object)null && ShouldCollectSharedMetric(val))
				{
					RegisterPlayer(val);
					PlayerScoreStats orCreateStats = GetOrCreateStats(num);
					float enemyMaxHealth = GetEnemyMaxHealth(damagedAgent, damageBase);
					if (IsScout(damagedAgent))
					{
						orCreateStats.ScoutKills++;
					}
					else if (enemyMaxHealth >= 300f)
					{
						orCreateStats.BossKills++;
					}
					else if (enemyMaxHealth >= 100f && enemyMaxHealth < 300f)
					{
						orCreateStats.LargeKills++;
					}
					else
					{
						orCreateStats.SmallKills++;
					}
					if (flag || damageSourceType == DamageSourceType.Melee)
					{
						orCreateStats.MeleeKills++;
					}
					if (damageSourceType == DamageSourceType.Tool)
					{
						orCreateStats.ToolKills++;
					}
					if ((enemyKey != IntPtr.Zero && _enemyAttribution.TryGetValue(enemyKey, out EnemyAttribution value2) && value2.LastDamageWasSleepingTarget) || IsEnemySleeping(damagedAgent))
					{
						orCreateStats.StealthKills++;
					}
				}
			}
			finally
			{
				if (enemyKey != IntPtr.Zero)
				{
					_enemyAttribution.Remove(enemyKey);
				}
			}
		}

		public void OnNativePlayerDamaged(PlayerDamageInfo? info)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			if (!((Object)((info != null) ? info.DamagedAgent : null) == (Object)null) && !(info.Damage <= 0f) && ShouldCollectSharedMetric(info.DamagedAgent))
			{
				CountDamageTaken(info.DamagedAgent, info.Damage);
			}
		}

		public void OnNativePlayerDowned(PlayerAgent? player)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			if (!((Object)player == (Object)null) && ShouldCollectSharedMetric(player))
			{
				RegisterPlayer(player);
				ulong playerId = GetPlayerId(player);
				GetOrCreateStats(playerId).DownedCount++;
				_downStateByPlayer[playerId] = true;
			}
		}

		public void OnNativePlayerShotWeapon(PlayerAgent? player)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			if (!((Object)player == (Object)null) && ShouldCollectPeerOwnedMetric(player))
			{
				RegisterPlayer(player);
				CountWeaponShots(GetPlayerId(player), ResolveWeaponSlot(player), ResolveProjectileCountPerShot(player));
			}
		}

		public void OnNativePlayerActivatedTool(PlayerAgent? player, InventorySlot slot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)player == (Object)null))
			{
				RegisterPlayer(player);
				Verbose($"Tool activated. Player={GetPlayerId(player)} Slot={slot}");
			}
		}

		public void OnNativePlayerUsedFlashlight(PlayerAgent? player, bool enabled)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			if (!((Object)player == (Object)null))
			{
				RegisterPlayer(player);
				Verbose($"Flashlight used. Player={GetPlayerId(player)} Enabled={enabled}");
			}
		}

		public void OnNativePlayerUsedResource(PlayerAgent? giver, iResourcePackReceiver? receiver, eResourceContainerSpawnType type)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0023: 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_003f: Expected O, but got Unknown
			PlayerAgent val = ((receiver != null) ? ((Il2CppObjectBase)receiver).TryCast<PlayerAgent>() : null);
			if ((Object)val == (Object)null)
			{
				val = ResolvePlayerFromObject(receiver);
			}
			ResourcePackKind? resourcePackKind = ResolveResourcePackKind(type);
			if (resourcePackKind.HasValue && !((Object)val == (Object)null))
			{
				OnResourceReceived(val, giver, resourcePackKind.Value);
			}
		}

		public void OnNativePlayerUsedDisinfectionStation()
		{
			Verbose("Disinfection station used.");
		}

		public void OnNativePlayerTeleported(PlayerAgent? player, eDimensionIndex from, eDimensionIndex to)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0026: 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)
			if (!((Object)player == (Object)null))
			{
				RegisterPlayer(player);
				Verbose($"Player teleported. Player={GetPlayerId(player)} From={from} To={to}");
			}
		}

		public void OnNativeExpeditionComplete(RundownDataBlock rundownData, eRundownTier rundownTier, int expeditionIndex, ExpeditionEndState expeditionEndState)
		{
			MarkExpeditionEnded();
		}

		public void OnNativeReadLog(pLogRead log)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Verbose($"Log read. ID={log.ID}");
		}

		public void OnReviveSetup(Interact_Revive? interaction, PlayerAgent? owner)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			if (!((Object)interaction == (Object)null) && !((Object)owner == (Object)null))
			{
				RegisterPlayer(owner);
				_reviveTargetsByInteraction[((Object)interaction).GetInstanceID()] = owner;
			}
		}

		public void OnReviveCompleted(Interact_Revive? interaction, PlayerAgent? source)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			if ((Object)interaction == (Object)null || (Object)source == (Object)null || !ShouldCollectSharedMetric(source))
			{
				return;
			}
			string key = ((Object)interaction).GetInstanceID().ToString(CultureInfo.InvariantCulture) + ":" + GetPlayerId(source).ToString(CultureInfo.InvariantCulture);
			float time = Time.time;
			if (!_lastReviveCompletedAt.TryGetValue(key, out var value) || !(time - value <= 0.5f))
			{
				_lastReviveCompletedAt[key] = time;
				RegisterPlayer(source);
				GetOrCreateStats(GetPlayerId(source)).RescueCount++;
				PlayerAgent val = ResolveReviveTarget(interaction, source);
				if ((Object)val != (Object)null)
				{
					RegisterPlayer(val);
					_downStateByPlayer[GetPlayerId(val)] = false;
				}
			}
		}

		public void OnBioscanUpdated(CP_Bioscan_Core? core)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			if ((Object)core == (Object)null)
			{
				return;
			}
			int instanceID = ((Object)core).GetInstanceID();
			float time = Time.time;
			if (_nextBioscanSampleByCore.TryGetValue(instanceID, out var value) && time < value)
			{
				return;
			}
			_nextBioscanSampleByCore[instanceID] = time + 0.25f;
			try
			{
				List<PlayerAgent> currentBioscanPlayers = GetCurrentBioscanPlayers(core);
				if (currentBioscanPlayers.Count <= 0)
				{
					return;
				}
				for (int i = 0; i < currentBioscanPlayers.Count; i++)
				{
					PlayerAgent val = currentBioscanPlayers[i];
					if (!((Object)val == (Object)null) && ShouldCollectSharedMetric(val))
					{
						RegisterPlayer(val);
						GetOrCreateStats(GetPlayerId(val)).ScanParticipationSeconds += 0.25f;
					}
				}
			}
			catch (Exception ex)
			{
				ScoreboardLogger.Error("KAS bioscan sample failed.", ex);
			}
		}

		public void OnTerminalCommand(object? terminalOrInterpreter)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			PlayerAgent val = TryGetLocalPlayer() ?? TryGetSingleKnownPlayer();
			if (!((Object)val == (Object)null) && ShouldCollectLocalMetric(val))
			{
				Object val2 = (Object)((terminalOrInterpreter is Object) ? terminalOrInterpreter : null);
				int item = ((val2 != (Object)null) ? (val2.GetInstanceID() ^ Mathf.RoundToInt(Time.time * 2f)) : Mathf.RoundToInt(Time.time * 2f));
				if (_countedTerminalCommands.Add(item))
				{
					RegisterPlayer(val);
					GetOrCreateStats(GetPlayerId(val)).TerminalCommands++;
				}
			}
		}

		public void OnObjectivePickup(object? pickup, PlayerAgent? player)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			if (!IsObjectivePickup(pickup))
			{
				return;
			}
			if ((Object)(object)player == (Object)null)
			{
				player = TryGetLocalPlayer();
			}
			if (!((Object)player == (Object)null) && ShouldCollectSharedMetric(player))
			{
				Object val = (Object)((pickup is Object) ? pickup : null);
				int item = ((val != (Object)null) ? val.GetInstanceID() : (((Object)player).GetInstanceID() ^ Mathf.RoundToInt(Time.time * 10f)));
				if (_countedObjectivePickups.Add(item))
				{
					_hasObjectivePickups = true;
					RegisterPlayer(player);
					GetOrCreateStats(GetPlayerId(player)).ObjectivePickups++;
				}
			}
		}

		public ScoreboardSnapshot CreateLocalSnapshot()
		{
			TryRegisterLocalPlayer();
			TryRegisterPlayersInSlots();
			return new ScoreboardSnapshot
			{
				PluginVersion = "0.1.3",
				IsHostAuthoritative = IsHostAuthority,
				ExpeditionEnded = _expeditionEnded,
				HasObjectivePickups = _hasObjectivePickups,
				Timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
				Players = OrderedPlayerStats()
			};
		}

		public ScoreboardSnapshot CreatePeerSnapshot()
		{
			TryRegisterLocalPlayer();
			return new ScoreboardSnapshot
			{
				PluginVersion = "0.1.3",
				IsHostAuthoritative = false,
				ExpeditionEnded = _expeditionEnded,
				HasObjectivePickups = _hasObjectivePickups,
				Timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
				Players = OrderedLocalPlayerStats()
			};
		}

		public ScoreboardSnapshot CreateDisplaySnapshot()
		{
			ScoreboardSnapshot scoreboardSnapshot = CreateLocalSnapshot();
			if (!IsHostAuthority && _hostSnapshot.Players.Count > 0)
			{
				ScoreboardSnapshot scoreboardSnapshot2 = _hostSnapshot.Clone();
				scoreboardSnapshot2.MergeMax(scoreboardSnapshot);
				return scoreboardSnapshot2;
			}
			return scoreboardSnapshot;
		}

		public void ApplyHostSnapshot(ScoreboardSnapshot snapshot)
		{
			_hostSnapshot = snapshot.Clone();
		}

		public void MergePeerSnapshot(ScoreboardSnapshot snapshot)
		{
			if (!IsHostAuthority)
			{
				return;
			}
			foreach (PlayerScoreStats player in snapshot.Players)
			{
				MarkPeerSnapshotSeen(player.PlayerId);
				GetOrCreateStats(player.PlayerId).MergeMax(player);
			}
			_hasObjectivePickups |= snapshot.HasObjectivePickups;
			_expeditionEnded |= snapshot.ExpeditionEnded;
		}

		private void MarkPeerSnapshotSeen(ulong playerId)
		{
			if (playerId != 0L)
			{
				_peerSnapshotSeenAtByPlayer[playerId] = Time.time;
			}
		}

		private bool IsPeerSnapshotFresh(ulong playerId)
		{
			if (playerId != 0L && _peerSnapshotSeenAtByPlayer.TryGetValue(playerId, out var value))
			{
				return Time.time - value <= 8f;
			}
			return false;
		}

		private List<PlayerScoreStats> OrderedPlayerStats()
		{
			return (from player in new List<PlayerScoreStats>(_statsByPlayer.Values).ConvertAll((PlayerScoreStats player) => player.Clone()).FindAll(ShouldExportPlayer)
				orderby (player.PlayerSlot < 0) ? int.MaxValue : player.PlayerSlot, player.PlayerId
				select player).ToList();
		}

		private List<PlayerScoreStats> OrderedLocalPlayerStats()
		{
			ulong localPlayerId = GetLocalPlayerId();
			if (localPlayerId == 0L)
			{
				return new List<PlayerScoreStats>();
			}
			return (from player in new List<PlayerScoreStats>(_statsByPlayer.Values).ConvertAll((PlayerScoreStats player) => player.Clone()).FindAll((PlayerScoreStats player) => player.PlayerId == localPlayerId && ShouldExportPlayer(player))
				orderby (player.PlayerSlot < 0) ? int.MaxValue : player.PlayerSlot, player.PlayerId
				select player).ToList();
		}

		private PlayerScoreStats GetOrCreateStats(ulong playerId)
		{
			if (playerId == 0L)
			{
				playerId = 999999uL;
			}
			if (_statsByPlayer.TryGetValue(playerId, out PlayerScoreStats value))
			{
				return value;
			}
			value = new PlayerScoreStats
			{
				PlayerId = playerId,
				PlayerName = "Player " + playerId.ToString(CultureInfo.InvariantCulture)
			};
			_statsByPlayer[playerId] = value;
			return value;
		}

		private EnemyAttribution GetOrCreateAttribution(IntPtr key)
		{
			if (_enemyAttribution.TryGetValue(key, out EnemyAttribution value))
			{
				return value;
			}
			value = new EnemyAttribution();
			_enemyAttribution[key] = value;
			return value;
		}

		private void TryRegisterLocalPlayer()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			PlayerAgent val = TryGetLocalPlayer();
			if ((Object)val != (Object)null)
			{
				RegisterPlayer(val);
			}
		}

		private void TryRegisterPlayersInSlots()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			try
			{
				List<PlayerAgent> playerAgentsInLevel = PlayerManager.PlayerAgentsInLevel;
				if (playerAgentsInLevel == null)
				{
					return;
				}
				for (int i = 0; i < playerAgentsInLevel.Count; i++)
				{
					PlayerAgent val = playerAgentsInLevel[i];
					if ((Object)val != (Object)null && SafePlayerSlot(val) >= 0)
					{
						RegisterPlayer(val);
					}
				}
			}
			catch
			{
			}
		}

		private PlayerAgent? TryGetLocalPlayer()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			try
			{
				PlayerAgent val = null;
				if (PlayerManager.TryGetLocalPlayerAgent(ref val) && (Object)val != (Object)null)
				{
					return val;
				}
			}
			catch
			{
			}
			return null;
		}

		private ulong GetLocalPlayerId()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			if (_localPlayerId != 0L)
			{
				return _localPlayerId;
			}
			PlayerAgent val = TryGetLocalPlayer();
			if ((Object)val == (Object)null)
			{
				return 0uL;
			}
			RegisterPlayer(val);
			return _localPlayerId;
		}

		private bool ShouldCollectPeerOwnedMetric(PlayerAgent? player)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			if ((Object)player == (Object)null)
			{
				return false;
			}
			try
			{
				SNet_Player owner = player.Owner;
				if ((Object)owner == (Object)null)
				{
					return true;
				}
				if (owner.IsLocal || owner.IsBot)
				{
					return true;
				}
				return false;
			}
			catch
			{
				return true;
			}
		}

		private bool ShouldCollectSharedMetric(PlayerAgent? player)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			if ((Object)player == (Object)null)
			{
				return false;
			}
			try
			{
				SNet_Player owner = player.Owner;
				if ((Object)owner == (Object)null)
				{
					return true;
				}
				if (owner.IsLocal || owner.IsBot)
				{
					return true;
				}
				return IsHostAuthority && IsRemoteHumanPlayer(player);
			}
			catch
			{
				return true;
			}
		}

		private static bool ShouldCollectLocalMetric(PlayerAgent? player)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			if ((Object)player == (Object)null)
			{
				return false;
			}
			try
			{
				SNet_Player owner = player.Owner;
				return (Object)owner == (Object)null || owner.IsLocal;
			}
			catch
			{
				return true;
			}
		}

		private static bool IsLocalHumanPlayer(PlayerAgent? player)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			if ((Object)player == (Object)null)
			{
				return false;
			}
			try
			{
				SNet_Player owner = player.Owner;
				return (Object)owner != (Object)null && owner.IsLocal && !owner.IsBot;
			}
			catch
			{
				return false;
			}
		}

		private PlayerAgent? TryGetSingleKnownPlayer()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_002c: 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_003c: Expected O, but got Unknown
			//IL_003c: Expected O, but got Unknown
			PlayerAgent val = null;
			foreach (PlayerAgent value in _playersByUnityId.Values)
			{
				if ((Object)val != (Object)null && (Object)val != (Object)value)
				{
					return null;
				}
				val = value;
			}
			return val;
		}

		private static List<PlayerAgent> GetCurrentBioscanPlayers(CP_Bioscan_Core core)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_0015: Invalid comparison between Unknown and I4
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			List<PlayerAgent> list = new List<PlayerAgent>(4);
			try
			{
				pBioscanState state = core.State;
				if ((int)state.status != 3 || state.playersInScan <= 0)
				{
					return list;
				}
				AddBioscanPlayer(list, state.playerInScan1);
				AddBioscanPlayer(list, state.playerInScan2);
				AddBioscanPlayer(list, state.playerInScan3);
				AddBioscanPlayer(list, state.playerInScan4);
			}
			catch
			{
			}
			return list;
		}

		private static void AddBioscanPlayer(List<PlayerAgent> players, pPlayer packedPlayer)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			try
			{
				SNet_Player val = null;
				if (!((pPlayer)(ref packedPlayer)).TryGetPlayer(ref val) || (Object)val == (Object)null)
				{
					return;
				}
				int num = val.PlayerSlotIndex();
				if (num >= 0)
				{
					PlayerAgent val2 = FindPlayerAgentInSlot(num);
					if ((Object)val2 != (Object)null && !players.Contains(val2))
					{
						players.Add(val2);
					}
				}
			}
			catch
			{
			}
		}

		private PlayerAgent? ResolvePlayer(Agent? agent)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			if ((Object)agent == (Object)null)
			{
				return null;
			}
			PlayerAgent val = (PlayerAgent)((agent is PlayerAgent) ? agent : null);
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
			if (agent.GameObjectID > 0 && _playersByAgentId.TryGetValue(agent.GameObjectID, out PlayerAgent value))
			{
				return value;
			}
			int instanceID = ((Object)agent).GetInstanceID();
			if (instanceID != 0 && _playersByUnityId.TryGetValue(instanceID, out PlayerAgent value2))
			{
				return value2;
			}
			return null;
		}

		private PlayerAgent? ResolvePlayerFromObject(object? source)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			if (source == null)
			{
				return null;
			}
			PlayerAgent val = (PlayerAgent)((source is PlayerAgent) ? source : null);
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
			Type type = source.GetType();
			string[] array = new string[11]
			{
				"Owner", "owner", "m_owner", "OwnerAgent", "m_ownerAgent", "Player", "player", "SourcePlayer", "m_agent", "Agent",
				"agent"
			};
			foreach (string name in array)
			{
				try
				{
					object obj = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(source);
					PlayerAgent val2 = (PlayerAgent)((obj is PlayerAgent) ? obj : null);
					if ((Object)(object)val2 != (Object)null)
					{
						return val2;
					}
					object obj2 = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(source);
					PlayerAgent val3 = (PlayerAgent)((obj2 is PlayerAgent) ? obj2 : null);
					if ((Object)(object)val3 != (Object)null)
					{
						return val3;
					}
				}
				catch
				{
				}
			}
			return null;
		}

		private static bool IsObjectivePickup(object? pickup)
		{
			if (pickup == null)
			{
				return false;
			}
			string text = pickup.GetType().FullName ?? pickup.GetType().Name;
			if (text.IndexOf("ArtifactPickup_Core", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("CarryItemPickup_Core", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return true;
			}
			try
			{
				Type type = pickup.GetType();
				string[] array = new string[4] { "m_isWardenObjective", "IsWardenObjective", "ObjectiveItemSolved", "WardenObjectiveChainIndex" };
				foreach (string name in array)
				{
					PropertyInfo property = type.GetProperty(name, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					if (property != null)
					{
						object value = property.GetValue(pickup);
						if (value is bool result)
						{
							return result;
						}
						if (value is int num)
						{
							return num >= 0;
						}
					}
					FieldInfo field = type.GetField(name, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					if (field != null)
					{
						object value2 = field.GetValue(pickup);
						if (value2 is bool result2)
						{
							return result2;
						}
						if (value2 is int num2)
						{
							return num2 >= 0;
						}
					}
				}
			}
			catch
			{
			}
			return false;
		}

		private PlayerAgent? ResolveReviveTarget(Interact_Revive interaction, PlayerAgent source)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			int instanceID = ((Object)interaction).GetInstanceID();
			if (_reviveTargetsByInteraction.TryGetValue(instanceID, out PlayerAgent value) && (Object)value != (Object)null && GetPlayerId(value) != GetPlayerId(source))
			{
				_reviveTargetsByInteraction.Remove(instanceID);
				return value;
			}
			try
			{
				PlayerAgent interactTargetAgent = ((Interact_Timed)interaction).m_interactTargetAgent;
				if ((Object)interactTargetAgent != (Object)null && GetPlayerId(interactTargetAgent) != GetPlayerId(source))
				{
					return interactTargetAgent;
				}
			}
			catch
			{
			}
			return null;
		}

		private static WeaponScoreStats GetWeaponStats(PlayerScoreStats stats, DamageSourceType sourceType)
		{
			if (sourceType != DamageSourceType.SecondaryWeapon)
			{
				return stats.PrimaryWeapon;
			}
			return stats.SecondaryWeapon;
		}

		private void CountDamageTaken(PlayerAgent player, float amount)
		{
			amount = Mathf.Max(0f, amount);
			if (!(amount <= 0f))
			{
				RegisterPlayer(player);
				ulong playerId = GetPlayerId(player);
				float time = Time.time;
				if (!_lastDamageTakenAt.TryGetValue(playerId, out var value) || !_lastDamageTakenAmount.TryGetValue(playerId, out var value2) || !(Mathf.Abs(value2 - amount) <= 0.01f) || !(time - value <= 0.05f))
				{
					_lastDamageTakenAt[playerId] = time;
					_lastDamageTakenAmount[playerId] = amount;
					GetOrCreateStats(playerId).DamageTaken += amount;
				}
			}
		}

		private void CountKillFromAttribution(EnemyAgent enemy, Dam_EnemyDamageBase damageBase, EnemyAttribution attribution)
		{
			ulong lastDamageDealer = attribution.LastDamageDealer;
			if (lastDamageDealer != 0L)
			{
				PlayerScoreStats orCreateStats = GetOrCreateStats(lastDamageDealer);
				float num = Mathf.Max(attribution.LastKnownHealthMax, GetEnemyMaxHealth(enemy, damageBase));
				if (attribution.IsScout || IsScout(enemy))
				{
					orCreateStats.ScoutKills++;
				}
				else if (num >= 300f)
				{
					orCreateStats.BossKills++;
				}
				else if (num >= 100f && num < 300f)
				{
					orCreateStats.LargeKills++;
				}
				else
				{
					orCreateStats.SmallKills++;
				}
				if (attribution.LastDamageWasMelee || attribution.LastDamageSource == DamageSourceType.Melee)
				{
					orCreateStats.MeleeKills++;
				}
				if (attribution.LastDamageSource == DamageSourceType.Tool)
				{
					orCreateStats.ToolKills++;
				}
				if (attribution.LastDamageWasSleepingTarget)
				{
					orCreateStats.StealthKills++;
				}
			}
		}

		private void CountWeaponShots(ulong playerId, DamageSourceType sourceType, int count)
		{
			if (count > 0 && (sourceType == DamageSourceType.PrimaryWeapon || sourceType == DamageSourceType.SecondaryWeapon))
			{
				GetWeaponStats(GetOrCreateStats(playerId), sourceType).ShotsFired += count;
			}
		}

		private void CountReceivedEnemyDamage(Dam_EnemyDamageBase damageBase, Agent? sourceAgent, float damage, int limbId, DamageSourceType fallbackSourceType, bool isMelee, bool wasSleepingTarget)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			if (damage <= 0f)
			{
				return;
			}
			EnemyAgent enemyFromDamageBase = GetEnemyFromDamageBase(damageBase);
			PlayerAgent val = ResolvePlayer(sourceAgent) ?? ResolvePlayerFromObject(sourceAgent);
			DamageSourceType damageSourceType = fallbackSourceType;
			if (!isMelee && (Object)val != (Object)null)
			{
				damageSourceType = ResolveWeaponSlot(val);
			}
			ulong num = (((Object)val != (Object)null) ? GetPlayerId(val) : 0);
			IntPtr enemyKey = GetEnemyKey(enemyFromDamageBase, damageBase);
			EnemyAttribution enemyAttribution = ((enemyKey != IntPtr.Zero) ? GetOrCreateAttribution(enemyKey) : null);
			bool flag = IsWeakspotLimb(damageBase, limbId);
			bool flag2 = num != 0L && ShouldCollectSharedMetric(val);
			if (flag2)
			{
				RegisterPlayer(val);
				CountEnemyDamage(enemyAttribution, num, damage, damageSourceType, flag, isMelee);
			}
			if (enemyAttribution != null)
			{
				if (flag2)
				{
					enemyAttribution.LastDamageDealer = num;
					enemyAttribution.LastDamageTime = Time.time;
					enemyAttribution.LastDamageSource = damageSourceType;
					enemyAttribution.LastDamageWasWeakspot = flag;
					enemyAttribution.LastDamageWasMelee = isMelee;
					enemyAttribution.LastDamageWasSleepingTarget = wasSleepingTarget || IsEnemySleeping(enemyFromDamageBase);
				}
				enemyAttribution.LastKnownHealthMax = Mathf.Max(enemyAttribution.LastKnownHealthMax, GetEnemyMaxHealth(enemyFromDamageBase, damageBase));
				enemyAttribution.EnemyDataId = SafeEnemyDataId(enemyFromDamageBase);
				enemyAttribution.IsScout |= IsScout(enemyFromDamageBase);
			}
		}

		private void CountEnemyDamage(EnemyAttribution? attribution, ulong playerId, float damage, DamageSourceType sourceType, bool isWeakspot, bool isMelee)
		{
			float num = Mathf.Max(0f, damage);
			if (num <= 0f)
			{
				return;
			}
			float time = Time.time;
			if (attribution != null && attribution.LastCountedDamageDealer == playerId && Mathf.Abs(attribution.LastCountedDamageAmount - num) <= 0.01f && time - attribution.LastCountedDamageTime <= 0.05f)
			{
				return;
			}
			PlayerScoreStats orCreateStats = GetOrCreateStats(playerId);
			orCreateStats.TotalDamage += num;
			if (!isMelee && (sourceType == DamageSourceType.PrimaryWeapon || sourceType == DamageSourceType.SecondaryWeapon))
			{
				WeaponScoreStats weaponStats = GetWeaponStats(orCreateStats, sourceType);
				weaponStats.Hits++;
				if (isWeakspot)
				{
					weaponStats.WeakspotHits++;
				}
			}
			if (attribution != null)
			{
				attribution.LastCountedDamageDealer = playerId;
				attribution.LastCountedDamageTime = time;
				attribution.LastCountedDamageAmount = num;
			}
		}

		private static DamageSourceType ResolveDamageSourceType(PlayerAgent? sourcePlayer, Agent? sourceAgent)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			if ((Object)sourcePlayer != (Object)null)
			{
				try
				{
					FirstPersonItemHolder fPItemHolder = sourcePlayer.FPItemHolder;
					object obj;
					if ((Object)(object)fPItemHolder == (Object)null)
					{
						obj = null;
					}
					else
					{
						ItemEquippable wieldedItem = fPItemHolder.WieldedItem;
						obj = (((Object)(object)wieldedItem != (Object)null) ? ((Il2CppObjectBase)wieldedItem).TryCast<BulletWeapon>() : null);
					}
					BulletWeapon val = (BulletWeapon)obj;
					if ((Object)val != (Object)null)
					{
						return ResolveWeaponSlot(val);
					}
				}
				catch
				{
				}
				return DamageSourceType.PrimaryWeapon;
			}
			if (!IsToolSourceName(((Object)sourceAgent == (Object)null) ? string.Empty : (((object)sourceAgent).GetType().FullName ?? ((object)sourceAgent).GetType().Name)))
			{
				return DamageSourceType.Unknown;
			}
			return DamageSourceType.Tool;
		}

		private static DamageSourceType ResolveNativeDamageSourceType(PlayerAgent? sourcePlayer, Agent? sourceAgent, uint gearCategoryId)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			try
			{
				if (AchievementManager.IsMelee(gearCategoryId))
				{
					return DamageSourceType.Melee;
				}
			}
			catch
			{
			}
			if (IsToolSourceName(((Object)sourceAgent == (Object)null) ? string.Empty : (((object)sourceAgent).GetType().FullName ?? ((object)sourceAgent).GetType().Name)))
			{
				return DamageSourceType.Tool;
			}
			if (!((Object)sourcePlayer != (Object)null))
			{
				return DamageSourceType.Unknown;
			}
			return