Decompiled source of EnemyReport v1.3.1

miru-y.EnemyReport.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using Microsoft.CodeAnalysis;
using REPOLib.Modules;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Discord.Sdk")]
[assembly: IgnoresAccessChecksTo("Domain_Reload")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.MemoryProfiler")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Splines")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("miru-y")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Instantly report enemies and share information with your party!")]
[assembly: AssemblyFileVersion("1.3.1.0")]
[assembly: AssemblyInformationalVersion("1.3.1")]
[assembly: AssemblyProduct("EnemyReport")]
[assembly: AssemblyTitle("miru-y.EnemyReport")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/pneben/Repo-MapVote")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.1.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace EnemyReport
{
	public static class EnemyData
	{
		public enum Enemy
		{
			ApexPredator = 1,
			Bella = 2,
			BirthdayBoy = 3,
			Elsa = 4,
			Gnome = 5,
			Peeper = 6,
			ShadowChild = 7,
			Spewer = 8,
			Tick = 9,
			Animal = 1001,
			Banger = 1002,
			Bowtie = 1003,
			Chef = 1004,
			Gambit = 1005,
			Headgrab = 1006,
			HeartHugger = 1007,
			Hidden = 1008,
			Mentalist = 1009,
			Oogly = 1010,
			Rugrat = 1011,
			Upscream = 1012,
			Clown = 2001,
			CleanupCrew = 2002,
			Headman = 2003,
			Huntsman = 2004,
			Loom = 2005,
			Reaper = 2006,
			Robe = 2007,
			Trudge = 2008
		}

		public class SpawnData
		{
			public int stageMin { get; private set; }

			public int stageMax { get; private set; }

			public int tier1Num { get; private set; }

			public int tier2Num { get; private set; }

			public int tier3Num { get; private set; }

			public TextMeshProUGUI? spawnLevelText { get; private set; }

			public TextMeshProUGUI? spawnTier1Text { get; private set; }

			public TextMeshProUGUI? spawnTier2Text { get; private set; }

			public TextMeshProUGUI? spawnTier3Text { get; private set; }

			public SpawnData(int stage_min, int stage_max, int tier1_num, int tier2_num, int tier3_num)
			{
				stageMin = stage_min;
				stageMax = stage_max;
				tier1Num = tier1_num;
				tier2Num = tier2_num;
				tier3Num = tier3_num;
			}

			public void SetSpawnText(TextMeshProUGUI? spawn_level_text, TextMeshProUGUI? spawn_tier1_text, TextMeshProUGUI? spawn_tier2_text, TextMeshProUGUI? spawn_tier3_text)
			{
				spawnLevelText = spawn_level_text;
				spawnTier1Text = spawn_tier1_text;
				spawnTier2Text = spawn_tier2_text;
				spawnTier3Text = spawn_tier3_text;
			}

			public void UpdateText()
			{
				int num = RunManager.instance.levelsCompleted + 1;
				bool flag = false;
				if ((Object)(object)spawnLevelText != (Object)null)
				{
					string text = "";
					if (stageMin == stageMax)
					{
						text = $"<color=#808080>{stageMin}</color>";
						if (num == stageMin)
						{
							text = $"<color=orange>{stageMin}</color>";
							flag = true;
						}
					}
					else if (stageMax == int.MaxValue)
					{
						text = $"<color=#808080>{stageMin}-</color>";
						if (num >= stageMin)
						{
							text = $"<color=orange>{stageMin}-</color>";
							flag = true;
						}
					}
					else
					{
						text = $"<color=#808080>{stageMin}-{stageMax}</color>";
						if (num >= stageMin && num <= stageMax)
						{
							text = $"<color=orange>{stageMin}-{stageMax}</color>";
							flag = true;
						}
					}
					((TMP_Text)spawnLevelText).horizontalAlignment = (HorizontalAlignmentOptions)4;
					((TMP_Text)spawnLevelText).fontSize = 32f;
					((TMP_Text)spawnLevelText).SetText(text ?? "", true);
				}
				if ((Object)(object)spawnTier1Text != (Object)null)
				{
					string text2 = (flag ? $"<color=orange>{tier1Num}</color>" : $"<color=#808080>{tier1Num}</color>");
					((TMP_Text)spawnTier1Text).horizontalAlignment = (HorizontalAlignmentOptions)2;
					((TMP_Text)spawnTier1Text).fontSize = 32f;
					((TMP_Text)spawnTier1Text).SetText(text2 ?? "", true);
				}
				if ((Object)(object)spawnTier2Text != (Object)null)
				{
					string text3 = (flag ? $"<color=orange>{tier2Num}</color>" : $"<color=#808080>{tier2Num}</color>");
					((TMP_Text)spawnTier2Text).horizontalAlignment = (HorizontalAlignmentOptions)2;
					((TMP_Text)spawnTier2Text).fontSize = 32f;
					((TMP_Text)spawnTier2Text).SetText(text3 ?? "", true);
				}
				if ((Object)(object)spawnTier3Text != (Object)null)
				{
					string text4 = (flag ? $"<color=orange>{tier3Num}</color>" : $"<color=#808080>{tier3Num}</color>");
					((TMP_Text)spawnTier3Text).horizontalAlignment = (HorizontalAlignmentOptions)2;
					((TMP_Text)spawnTier3Text).fontSize = 32f;
					((TMP_Text)spawnTier3Text).SetText(text4 ?? "", true);
				}
			}
		}

		public class Data
		{
			public TextMeshProUGUI? strengthLabelTMP;

			public TextMeshProUGUI? strengthTitleLabelTMP;

			public Enemy enemy { get; private set; } = Enemy.Animal;


			public int strength { get; private set; }

			public Data(Enemy enemy, int strength)
			{
				this.enemy = enemy;
				this.strength = strength;
			}

			public string GetEnemyName()
			{
				string name = Enum.GetName(typeof(Enemy), enemy);
				if (enemy.IsTier1())
				{
					return "<color=#00FFFF>[T1] " + name + "</color>";
				}
				if (enemy.IsTier2())
				{
					return "<color=yellow>[T2] " + name + "</color>";
				}
				if (enemy.IsTier3())
				{
					return "<color=red>[T3] " + name + "</color>";
				}
				return "";
			}

			public void UpdateTexts()
			{
				if ((Object)(object)strengthLabelTMP != (Object)null)
				{
					bool flag = strength >= 0 && EnemyReport.instance.selfStrength >= strength;
					((TMP_Text)strengthLabelTMP).SetText(string.Format("{0} {1}({2})</color>", GetEnemyName(), flag ? "<color=orange>" : "<color=#808080>", (strength >= 0) ? ((object)strength) : "Impossible"), true);
				}
				if ((Object)(object)strengthTitleLabelTMP != (Object)null)
				{
					bool flag2 = strength >= 0 && EnemyReport.instance.selfStrength >= strength;
					((TMP_Text)strengthTitleLabelTMP).SetText(string.Format("<color=white>Strength: {0}{1}</color></color>", flag2 ? "<color=orange>" : "<color=#808080>", (strength >= 0) ? ((object)strength) : "Impossible"), true);
				}
			}
		}

		public static Data[] datas = new Data[29]
		{
			new Data(Enemy.ApexPredator, -1),
			new Data(Enemy.Bella, 9),
			new Data(Enemy.BirthdayBoy, 4),
			new Data(Enemy.Elsa, -1),
			new Data(Enemy.Gnome, 0),
			new Data(Enemy.Peeper, -1),
			new Data(Enemy.ShadowChild, 9),
			new Data(Enemy.Spewer, 4),
			new Data(Enemy.Tick, 0),
			new Data(Enemy.Animal, 4),
			new Data(Enemy.Banger, 0),
			new Data(Enemy.Bowtie, 7),
			new Data(Enemy.Chef, 9),
			new Data(Enemy.Gambit, 9),
			new Data(Enemy.Headgrab, 4),
			new Data(Enemy.HeartHugger, 9),
			new Data(Enemy.Hidden, 4),
			new Data(Enemy.Mentalist, 4),
			new Data(Enemy.Oogly, 9),
			new Data(Enemy.Rugrat, 4),
			new Data(Enemy.Upscream, 4),
			new Data(Enemy.Clown, 13),
			new Data(Enemy.CleanupCrew, 13),
			new Data(Enemy.Headman, 13),
			new Data(Enemy.Huntsman, 9),
			new Data(Enemy.Loom, 13),
			new Data(Enemy.Reaper, 9),
			new Data(Enemy.Robe, 13),
			new Data(Enemy.Trudge, 13)
		};

		public static string GetResourceName(this Enemy _this)
		{
			string arg = "";
			if (_this.IsTier1())
			{
				arg = "Tier1";
			}
			else if (_this.IsTier2())
			{
				arg = "Tier2";
			}
			else if (_this.IsTier3())
			{
				arg = "Tier3";
			}
			return $"EnemyReport.Resources.{arg}_{_this}.png";
		}

		public static bool IsTier1(this Enemy _this)
		{
			if ((uint)(_this - 1) <= 8u)
			{
				return true;
			}
			return false;
		}

		public static bool IsTier2(this Enemy _this)
		{
			if ((uint)(_this - 1001) <= 11u)
			{
				return true;
			}
			return false;
		}

		public static bool IsTier3(this Enemy _this)
		{
			if ((uint)(_this - 2001) <= 7u)
			{
				return true;
			}
			return false;
		}
	}
	[BepInPlugin("miru-y.EnemyReport", "EnemyReport", "1.3.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal sealed class EnemyReport : BaseUnityPlugin
	{
		[Serializable]
		public class EnemyReportData
		{
			public int enemyId;

			public string reportPlayerName = "";

			public int steamIDshort;
		}

		private enum Tab
		{
			None,
			Report,
			Strength,
			Spawn
		}

		private enum EnemyReportAnimation
		{
			None,
			Begin,
			Loop,
			End
		}

		private class EnemyReportInfo
		{
			public TextMeshProUGUI? txt_ReportCount;

			public int reportCount { get; private set; }

			public void AddReportCount(int add)
			{
				reportCount = Mathf.Clamp(reportCount + add, 0, 99);
				UpdateText();
			}

			public void UpdateText()
			{
				if ((Object)(object)txt_ReportCount != (Object)null)
				{
					if (reportCount > 0)
					{
						((TMP_Text)txt_ReportCount).SetText($"<color=orange>{reportCount}</color>", true);
					}
					else
					{
						((TMP_Text)txt_ReportCount).SetText(reportCount.ToString(), true);
					}
				}
			}
		}

		public static EnemyReport? instance;

		private const float BASE_PITCH = 2.06f;

		private const float ADD_PITCH = -0.06f;

		private ConfigEntry<string>? enemyReportKeyCodeName;

		private ConfigEntry<float>? noticeFadeBeginTime;

		private ConfigEntry<float>? noticeFadeEndTime;

		private ConfigEntry<float>? noticeWaitTime;

		private TextMeshProUGUI? headerLabelTMP;

		private KeyCode enemyReportKeyCode = (KeyCode)114;

		private readonly ManualLogSource logger = Logger.CreateLogSource("EnemyReport");

		private NetworkedEvent? onEnemyReportEvent;

		private REPOPopupPage? enemyReportPopup;

		private Transform? t_Scroller;

		private Transform? t_Handle;

		private Transform? t_EnemyReportScrollControl;

		private Transform? t_EnemyReportHeader;

		private CanvasGroup? enemyReportCanvasGroup;

		private REPOPopupPage? strengthPopup;

		private CanvasGroup? strengthCanvasGroup;

		private REPOPopupPage? spawnPopup;

		private CanvasGroup? spawnCanvasGroup;

		private SortedDictionary<int, EnemyReportInfo> enemyCountTable = new SortedDictionary<int, EnemyReportInfo>();

		private REPOLabel? txt_EnemyReportTitle;

		private REPOLabel? txt_EnemyReportDescription;

		private REPOLabel? txt_EnemyReporter;

		private REPOLabel? txt_EnemyReportInfo;

		private bool isMapActive;

		private EnemyReportAnimation reportAnimation;

		private float reportAnimationTime;

		private int enemyIndex;

		private int strengthIndex;

		private bool isSwapPopup;

		private bool isOpen;

		public int selfStrength;

		private List<EnemyData.Data> enemyStrengthDataList = new List<EnemyData.Data>();

		private List<EnemyData.SpawnData> enemySpawnDataList = new List<EnemyData.SpawnData>();

		private List<GameObject> spawnHeaderObjectList = new List<GameObject>();

		private Tab tab;

		private REPOButton? btn_Report;

		private REPOButton? btn_Strength;

		private REPOButton? btn_Spawn;

		private float? reportBackupPosition;

		private float? reportBackupPosition2;

		private float? strengthBackupPosition;

		private float? strengthBackupPosition2;

		private Harmony? harmony { get; set; }

		public void ResetEnemyReportInfo()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: 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_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			tab = Tab.None;
			if ((Object)(object)txt_EnemyReportTitle == (Object)null)
			{
				txt_EnemyReportTitle = MenuAPI.CreateREPOLabel((string)null, ((Component)GoalUI.instance).transform, new Vector2(-235f, -120f));
				((TMP_Text)txt_EnemyReportTitle.labelTMP).horizontalAlignment = (HorizontalAlignmentOptions)4;
				((TMP_Text)txt_EnemyReportTitle.labelTMP).verticalAlignment = (VerticalAlignmentOptions)256;
				((TMP_Text)txt_EnemyReportTitle.labelTMP).SetText("Enemy Report", true);
				((TMP_Text)txt_EnemyReportTitle.labelTMP).fontSize = 16f;
				((Component)txt_EnemyReportTitle).transform.localPosition = new Vector3(((Component)txt_EnemyReportTitle).transform.localPosition.x + 30f, ((Component)txt_EnemyReportTitle).transform.localPosition.y + 40f, ((Component)txt_EnemyReportTitle).transform.localPosition.z);
			}
			if ((Object)(object)txt_EnemyReportDescription == (Object)null)
			{
				txt_EnemyReportDescription = MenuAPI.CreateREPOLabel((string)null, ((Component)GoalUI.instance).transform, new Vector2(-235f, -140f));
				((TMP_Text)txt_EnemyReportDescription.labelTMP).horizontalAlignment = (HorizontalAlignmentOptions)1;
				((TMP_Text)txt_EnemyReportDescription.labelTMP).verticalAlignment = (VerticalAlignmentOptions)256;
				((TMP_Text)txt_EnemyReportDescription.labelTMP).SetText($"[{enemyReportKeyCode}]: Open UI", true);
				((TMP_Text)txt_EnemyReportDescription.labelTMP).fontSize = 11f;
				((Component)txt_EnemyReportDescription).transform.localPosition = new Vector3(((Component)txt_EnemyReportDescription).transform.localPosition.x + 30f + 124f, ((Component)txt_EnemyReportDescription).transform.localPosition.y + 40f + 4f, ((Component)txt_EnemyReportDescription).transform.localPosition.z);
			}
			if ((Object)(object)txt_EnemyReporter == (Object)null)
			{
				txt_EnemyReporter = MenuAPI.CreateREPOLabel((string)null, ((Component)GoalUI.instance).transform, new Vector2(-235f, -153f));
				((TMP_Text)txt_EnemyReporter.labelTMP).horizontalAlignment = (HorizontalAlignmentOptions)4;
				((TMP_Text)txt_EnemyReporter.labelTMP).verticalAlignment = (VerticalAlignmentOptions)256;
				((TMP_Text)txt_EnemyReporter.labelTMP).fontSize = 11f;
				((Graphic)txt_EnemyReporter.labelTMP).color = Color.white;
				((Component)txt_EnemyReporter).transform.localPosition = new Vector3(((Component)txt_EnemyReporter).transform.localPosition.x + 30f, ((Component)txt_EnemyReporter).transform.localPosition.y + 40f, ((Component)txt_EnemyReporter).transform.localPosition.z);
			}
			if ((Object)(object)txt_EnemyReportInfo == (Object)null)
			{
				txt_EnemyReportInfo = MenuAPI.CreateREPOLabel((string)null, ((Component)GoalUI.instance).transform, new Vector2(-235f, -170f));
				((TMP_Text)txt_EnemyReportInfo.labelTMP).horizontalAlignment = (HorizontalAlignmentOptions)4;
				((TMP_Text)txt_EnemyReportInfo.labelTMP).verticalAlignment = (VerticalAlignmentOptions)256;
				((TMP_Text)txt_EnemyReportInfo.labelTMP).fontSize = 11f;
				((Graphic)txt_EnemyReportInfo.labelTMP).color = Color.white;
				((Component)txt_EnemyReportInfo).transform.localPosition = new Vector3(((Component)txt_EnemyReportInfo).transform.localPosition.x + 30f, ((Component)txt_EnemyReportInfo).transform.localPosition.y + 40f, ((Component)txt_EnemyReportInfo).transform.localPosition.z);
			}
			if (SemiFunc.RunIsLevel())
			{
				SetReportAnimation(EnemyReportAnimation.Begin);
			}
			REPOLabel? obj = txt_EnemyReportTitle;
			bool enabled = (((Behaviour)txt_EnemyReportDescription).enabled = SemiFunc.RunIsLevel());
			((Behaviour)obj).enabled = enabled;
			REPOLabel? obj2 = txt_EnemyReporter;
			if (obj2 != null)
			{
				((TMP_Text)obj2.labelTMP).SetText("", true);
			}
			enemyCountTable = new SortedDictionary<int, EnemyReportInfo>();
			foreach (EnemyData.Enemy value in Enum.GetValues(typeof(EnemyData.Enemy)))
			{
				enemyCountTable.Add((int)value, new EnemyReportInfo());
			}
			UpdateEnemyReportInfoText();
		}

		public void CloseEnemyReportPopup()
		{
			isOpen = false;
			MenuAPI.CloseAllPagesAddedOnTop();
			if ((Object)(object)enemyReportPopup != (Object)null)
			{
				enemyReportPopup.ClosePage(true);
			}
		}

		public void OpenEnemyReportPopup(bool isInMenu = false)
		{
			//IL_0070: 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_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Expected O, but got Unknown
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			isSwapPopup = false;
			CloseEnemyReportPopup();
			if (!SemiFunc.RunIsLevel() && !SemiFunc.RunIsLobby() && !SemiFunc.RunIsShop())
			{
				return;
			}
			isOpen = true;
			if ((Object)(object)enemyReportPopup == (Object)null)
			{
				enemyIndex = 0;
				enemyReportPopup = MenuAPI.CreateREPOPopupPage("Enemy Report", true, !isInMenu, 0f, (Vector2?)(isInMenu ? new Vector2(40f, 0f) : new Vector2(-100f, 0f)));
				headerLabelTMP = enemyReportPopup.headerTMP;
				t_EnemyReportScrollControl = ((Component)enemyReportPopup.menuScrollBox).transform;
				t_EnemyReportHeader = ((TMP_Text)enemyReportPopup.headerTMP).transform;
				t_Scroller = ((IEnumerable<Transform>)((Component)((Component)enemyReportPopup).transform).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "Scroller"));
				t_Handle = ((IEnumerable<Transform>)((Component)((Component)enemyReportPopup).transform).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "Handle"));
				enemyReportCanvasGroup = ((Component)enemyReportPopup).gameObject.AddComponent<CanvasGroup>();
				enemyReportPopup.AddElement((BuilderDelegate)delegate(Transform t)
				{
					//IL_0015: Unknown result type (might be due to invalid IL or missing references)
					//IL_001b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0055: 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_007a: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d3: 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_0113: 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_0174: Unknown result type (might be due to invalid IL or missing references)
					//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
					//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
					btn_Report = MenuAPI.CreateREPOButton("Report", (Action)delegate
					{
						if (!isSwapPopup)
						{
							((MonoBehaviour)this).StartCoroutine(SelectTab(Tab.Report));
						}
					}, t, default(Vector2));
					((TMP_Text)btn_Report.labelTMP).fontSize = 24f;
					((Transform)((REPOElement)btn_Report).rectTransform).localPosition = new Vector3(156.8f, 267.7f, 0f);
					btn_Strength = MenuAPI.CreateREPOButton("Strength", (Action)delegate
					{
						if (!isSwapPopup)
						{
							((MonoBehaviour)this).StartCoroutine(SelectTab(Tab.Strength));
						}
					}, t, default(Vector2));
					((TMP_Text)btn_Strength.labelTMP).fontSize = 24f;
					((Transform)((REPOElement)btn_Strength).rectTransform).localPosition = new Vector3(152.1f, 230.9f, 0f);
					btn_Spawn = MenuAPI.CreateREPOButton("Spawn", (Action)delegate
					{
						if (!isSwapPopup)
						{
							((MonoBehaviour)this).StartCoroutine(SelectTab(Tab.Spawn));
						}
					}, t, default(Vector2));
					((TMP_Text)btn_Spawn.labelTMP).fontSize = 24f;
					((Transform)((REPOElement)btn_Spawn).rectTransform).localPosition = new Vector3(159.3f, 194.8f, 0f);
					spawnHeaderObjectList.Clear();
					REPOLabel val = MenuAPI.CreateREPOLabel("Level", t, new Vector2(260.0158f, 272.8125f));
					((TMP_Text)val.labelTMP).fontSize = 24f;
					spawnHeaderObjectList.Add(((Component)val).gameObject);
					REPOLabel val2 = MenuAPI.CreateREPOLabel("<color=#00FFFF>Tier1</color>", t, new Vector2(328.52f, 272.8125f));
					((TMP_Text)val2.labelTMP).fontSize = 24f;
					spawnHeaderObjectList.Add(((Component)val2).gameObject);
					REPOLabel val3 = MenuAPI.CreateREPOLabel("<color=yellow>Tier2</color>", t, new Vector2(392.6239f, 272.8125f));
					((TMP_Text)val3.labelTMP).fontSize = 24f;
					spawnHeaderObjectList.Add(((Component)val3).gameObject);
					REPOLabel val4 = MenuAPI.CreateREPOLabel("<color=red>Tier3</color>", t, new Vector2(453.9276f, 272.8125f));
					((TMP_Text)val4.labelTMP).fontSize = 24f;
					spawnHeaderObjectList.Add(((Component)val4).gameObject);
				});
			}
			((Component)btn_Report).gameObject.SetActive(SemiFunc.RunIsLevel());
			selfStrength = 0;
			Dictionary<string, int> dictionary = StatsManager.instance.FetchPlayerUpgrades(PlayerController.instance.playerSteamID);
			dictionary.TryGetValue("Strength", out selfStrength);
			if ((Object)(object)strengthPopup == (Object)null)
			{
				enemyStrengthDataList.Clear();
				strengthIndex = 0;
				strengthPopup = MenuAPI.CreateREPOPopupPage($"Strength to Throw ({selfStrength})", true, false, 0f, (Vector2?)(isInMenu ? new Vector2(40f, 0f) : new Vector2(-100f, 0f)));
				((Component)strengthPopup).transform.SetParent(((Component)enemyReportPopup).transform);
				((Component)strengthPopup).transform.localPosition = Vector3.zero;
				strengthCanvasGroup = ((Component)strengthPopup).gameObject.AddComponent<CanvasGroup>();
			}
			else
			{
				if ((Object)(object)headerLabelTMP != (Object)null)
				{
					((TMP_Text)headerLabelTMP).SetText($"Strength to Throw ({selfStrength})", true);
				}
				foreach (EnemyData.Data enemyStrengthData in enemyStrengthDataList)
				{
					enemyStrengthData.UpdateTexts();
				}
			}
			if ((Object)(object)spawnPopup == (Object)null)
			{
				spawnPopup = MenuAPI.CreateREPOPopupPage($"Enemy Spawn Info ({RunManager.instance.levelsCompleted + 1})", true, false, 0f, (Vector2?)(isInMenu ? new Vector2(40f, 0f) : new Vector2(-100f, 0f)));
				spawnCanvasGroup = ((Component)spawnPopup).gameObject.AddComponent<CanvasGroup>();
				((Component)spawnPopup).transform.SetParent(((Component)enemyReportPopup).transform);
			}
			else
			{
				int i = 0;
				for (int count = enemySpawnDataList.Count; i < count; i++)
				{
					enemySpawnDataList[i].UpdateText();
				}
			}
			((MonoBehaviour)this).StartCoroutine(SelectTab(SemiFunc.RunIsLevel() ? Tab.Report : Tab.Strength, delegate
			{
				enemyReportPopup.OpenPage(true);
			}));
			UpdateButtonTexts();
			UpdateHeader();
		}

		private void Initialize()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			enemyReportKeyCodeName = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Enemy Report KeyCode Name", "R", new ConfigDescription("Key code for displaying the enemy report page.\nKeyCode Reference:https://docs.unity3d.com/ja/2022.3/ScriptReference/KeyCode.html", (AcceptableValueBase)null, Array.Empty<object>()));
			noticeFadeBeginTime = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Notice Fade Begin Time", 0.5f, new ConfigDescription("Notification fade-in duration.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
			noticeFadeEndTime = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Notice Fade End Time", 0.5f, new ConfigDescription("Notification fade-out duration.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
			noticeWaitTime = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Notice Wait Time", 3f, new ConfigDescription("Notification display time.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 60f), Array.Empty<object>()));
			if (Enum.TryParse<KeyCode>(enemyReportKeyCodeName.Value, out KeyCode result))
			{
				enemyReportKeyCode = result;
			}
			onEnemyReportEvent = new NetworkedEvent("EnemyReport", (Action<EventData>)OnEnemyReportEvent);
		}

		private void Update()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: Unknown result type (might be due to invalid IL or missing references)
			//IL_0443: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.PlayerAvatarLocal().playerHealth.health > 0)
			{
				if (((Object)(object)enemyReportPopup == (Object)null || !isOpen) && Input.GetKeyDown(enemyReportKeyCode) && !Object.op_Implicit((Object)(object)MenuManager.instance.currentMenuPage))
				{
					OpenEnemyReportPopup();
				}
				else if ((Object)(object)enemyReportPopup != (Object)null && isOpen && (Input.GetKeyDown(enemyReportKeyCode) || Input.GetKeyDown((KeyCode)27)))
				{
					CloseEnemyReportPopup();
				}
			}
			else if ((Object)(object)enemyReportPopup != (Object)null && isOpen)
			{
				CloseEnemyReportPopup();
			}
			if (isMapActive != Map.Instance.Active)
			{
				isMapActive = Map.Instance.Active;
				((Graphic)txt_EnemyReportInfo.labelTMP).color = ChangeColorAlpha(((Graphic)txt_EnemyReportInfo.labelTMP).color, isMapActive ? 1f : 0f);
				((Graphic)txt_EnemyReportTitle.labelTMP).color = ChangeColorAlpha(((Graphic)txt_EnemyReportTitle.labelTMP).color, isMapActive ? 1f : 0f);
				((Graphic)txt_EnemyReportDescription.labelTMP).color = ChangeColorAlpha(((Graphic)txt_EnemyReportDescription.labelTMP).color, isMapActive ? 1f : 0f);
			}
			if (!(reportAnimationTime > 0f))
			{
				return;
			}
			reportAnimationTime = Mathf.Max(reportAnimationTime - Time.deltaTime, 0f);
			switch (reportAnimation)
			{
			case EnemyReportAnimation.Begin:
				((Graphic)txt_EnemyReporter.labelTMP).color = ChangeColorAlpha(((Graphic)txt_EnemyReporter.labelTMP).color, Mathf.Lerp(0f, 1f, 1f - reportAnimationTime / GetReportAnimationTime(reportAnimation)));
				((Graphic)txt_EnemyReportInfo.labelTMP).color = ChangeColorAlpha(((Graphic)txt_EnemyReportInfo.labelTMP).color, Mathf.Lerp(0f, 1f, 1f - reportAnimationTime / GetReportAnimationTime(reportAnimation)));
				((Graphic)txt_EnemyReportTitle.labelTMP).color = ChangeColorAlpha(((Graphic)txt_EnemyReportTitle.labelTMP).color, Mathf.Lerp(0f, 1f, 1f - reportAnimationTime / GetReportAnimationTime(reportAnimation)));
				((Graphic)txt_EnemyReportDescription.labelTMP).color = ChangeColorAlpha(((Graphic)txt_EnemyReportDescription.labelTMP).color, Mathf.Lerp(0f, 1f, 1f - reportAnimationTime / GetReportAnimationTime(reportAnimation)));
				break;
			case EnemyReportAnimation.Loop:
				((Graphic)txt_EnemyReportInfo.labelTMP).color = ChangeColorAlpha(((Graphic)txt_EnemyReportInfo.labelTMP).color, 1f);
				((Graphic)txt_EnemyReportTitle.labelTMP).color = ChangeColorAlpha(((Graphic)txt_EnemyReportTitle.labelTMP).color, 1f);
				((Graphic)txt_EnemyReportDescription.labelTMP).color = ChangeColorAlpha(((Graphic)txt_EnemyReportDescription.labelTMP).color, 1f);
				break;
			case EnemyReportAnimation.End:
				((Graphic)txt_EnemyReporter.labelTMP).color = ChangeColorAlpha(((Graphic)txt_EnemyReporter.labelTMP).color, Mathf.Lerp(1f, 0f, 1f - reportAnimationTime / GetReportAnimationTime(reportAnimation)));
				((Graphic)txt_EnemyReportInfo.labelTMP).color = ChangeColorAlpha(((Graphic)txt_EnemyReportInfo.labelTMP).color, isMapActive ? 1f : Mathf.Lerp(1f, 0f, 1f - reportAnimationTime / GetReportAnimationTime(reportAnimation)));
				((Graphic)txt_EnemyReportTitle.labelTMP).color = ChangeColorAlpha(((Graphic)txt_EnemyReportTitle.labelTMP).color, Mathf.Lerp(1f, 0f, 1f - reportAnimationTime / GetReportAnimationTime(reportAnimation)));
				((Graphic)txt_EnemyReportDescription.labelTMP).color = ChangeColorAlpha(((Graphic)txt_EnemyReportDescription.labelTMP).color, Mathf.Lerp(1f, 0f, 1f - reportAnimationTime / GetReportAnimationTime(reportAnimation)));
				break;
			}
			if (reportAnimationTime == 0f)
			{
				switch (reportAnimation)
				{
				case EnemyReportAnimation.Begin:
					SetReportAnimation(EnemyReportAnimation.Loop);
					break;
				case EnemyReportAnimation.Loop:
					SetReportAnimation(EnemyReportAnimation.End);
					break;
				case EnemyReportAnimation.End:
					SetReportAnimation(EnemyReportAnimation.None);
					break;
				}
			}
		}

		public void Awake()
		{
			instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			Initialize();
			logger.LogDebug((object)"Loaded EnemyReport V1.3.1!");
		}

		private void Patch()
		{
			//IL_0019: 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_0020: Expected O, but got Unknown
			//IL_0025: Expected O, but got Unknown
			try
			{
				if (harmony == null)
				{
					Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
					Harmony val2 = val;
					harmony = val;
				}
				harmony.PatchAll();
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)ex);
			}
		}

		private void Unpatch()
		{
			Harmony? obj = harmony;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
		}

		private void OnEnemyReportEvent(EventData data)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			EnemyReportData enemyReportData = JsonUtility.FromJson<EnemyReportData>((string)data.CustomData);
			if (enemyReportData == null)
			{
				return;
			}
			int reportCount = enemyCountTable[Mathf.Abs(enemyReportData.enemyId)].reportCount;
			enemyCountTable[Mathf.Abs(enemyReportData.enemyId)].AddReportCount((enemyReportData.enemyId > 0) ? 1 : (-1));
			UpdateEnemyReportInfoText();
			TruckScreenText.instance.newLineSound.Play(MenuManager.instance.soundPosition, 1f, 1f, 1f, 1f);
			if (!SemiFunc.PlayerAvatarGetFromSteamIDshort(enemyReportData.steamIDshort).isLocal)
			{
				if (reportCount != enemyCountTable[Mathf.Abs(enemyReportData.enemyId)].reportCount)
				{
					string text = Enum.GetName(typeof(EnemyData.Enemy), (EnemyData.Enemy)Mathf.Abs(enemyReportData.enemyId));
					if (((EnemyData.Enemy)Mathf.Abs(enemyReportData.enemyId)).IsTier1())
					{
						text = "<color=#00FFFF>[" + text + "]</color>";
					}
					else if (((EnemyData.Enemy)Mathf.Abs(enemyReportData.enemyId)).IsTier2())
					{
						text = "<color=yellow>[" + text + "]</color>";
					}
					else if (((EnemyData.Enemy)Mathf.Abs(enemyReportData.enemyId)).IsTier3())
					{
						text = "<color=red>[" + text + "]</color>";
					}
					if (enemyCountTable[Mathf.Abs(enemyReportData.enemyId)].reportCount - reportCount > 0)
					{
						REPOLabel? obj = txt_EnemyReporter;
						if (obj != null)
						{
							((TMP_Text)obj.labelTMP).SetText(text + " reported by " + enemyReportData.reportPlayerName + "!", true);
						}
					}
					else
					{
						REPOLabel? obj2 = txt_EnemyReporter;
						if (obj2 != null)
						{
							((TMP_Text)obj2.labelTMP).SetText(text + " report canceled by " + enemyReportData.reportPlayerName + "!", true);
						}
					}
				}
			}
			else
			{
				REPOLabel? obj3 = txt_EnemyReporter;
				if (obj3 != null)
				{
					((TMP_Text)obj3.labelTMP).SetText("", true);
				}
			}
			SetReportAnimation(EnemyReportAnimation.Begin);
		}

		private void AddEnemyReportElement(EnemyData.Data data)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			EnemyData.Data data2 = data;
			string enemy_name = data2.GetEnemyName();
			REPOPopupPage? obj = enemyReportPopup;
			if (obj == null)
			{
				return;
			}
			obj.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform parent)
			{
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: 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_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_0122: Unknown result type (might be due to invalid IL or missing references)
				//IL_0138: Unknown result type (might be due to invalid IL or missing references)
				//IL_0148: Unknown result type (might be due to invalid IL or missing references)
				//IL_015d: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0209: Unknown result type (might be due to invalid IL or missing references)
				//IL_0213: Unknown result type (might be due to invalid IL or missing references)
				//IL_024b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0251: Unknown result type (might be due to invalid IL or missing references)
				//IL_0268: Unknown result type (might be due to invalid IL or missing references)
				//IL_027f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0289: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
				REPOButton val = MenuAPI.CreateREPOButton(enemy_name, (Action)null, parent, default(Vector2));
				((TMP_Text)val.labelTMP).fontSize = 24f;
				((REPOElement)val).rectTransform.anchoredPosition = new Vector2(((REPOElement)val).rectTransform.anchoredPosition.x + 21.38f, ((REPOElement)val).rectTransform.anchoredPosition.y);
				REPOButton val2 = MenuAPI.CreateREPOButton("+1", (Action)delegate
				{
					//IL_0052: Unknown result type (might be due to invalid IL or missing references)
					string text2 = JsonUtility.ToJson((object)new EnemyReportData
					{
						enemyId = (int)data2.enemy,
						reportPlayerName = SemiFunc.PlayerAvatarLocal().playerName,
						steamIDshort = SemiFunc.PlayerAvatarLocal().steamIDshort
					});
					NetworkedEvent? obj3 = onEnemyReportEvent;
					if (obj3 != null)
					{
						obj3.RaiseEvent((object)text2, NetworkingEvents.RaiseAll, SendOptions.SendReliable);
					}
				}, ((Component)val).transform, default(Vector2));
				int num = enemyIndex;
				val2.menuButton.buttonPitch = 2.06f + -0.06f * (float)num;
				Object.Destroy((Object)(object)((Component)val).GetComponent<MenuButton>());
				Object.Destroy((Object)(object)val);
				REPOButton component = Object.Instantiate<GameObject>(((Component)val).gameObject, (Transform)(object)((REPOElement)val).rectTransform).GetComponent<REPOButton>();
				TextMeshProUGUI[] componentsInChildren = ((Component)component).GetComponentsInChildren<TextMeshProUGUI>();
				if (componentsInChildren != null)
				{
					for (int i = 0; i < componentsInChildren.Length; i++)
					{
						((TMP_Text)componentsInChildren[i]).SetText("", true);
					}
				}
				((REPOElement)component).rectTransform.sizeDelta = new Vector2(((REPOElement)val).rectTransform.sizeDelta.y * 0.75f, ((REPOElement)val).rectTransform.sizeDelta.y * 0.75f);
				((Graphic)((Selectable)component.button).image).color = Color.white;
				((Graphic)((Selectable)component.button).image).raycastTarget = false;
				((Selectable)component.button).image.sprite = LoadSprite(data2.enemy.GetResourceName());
				((REPOElement)component).rectTransform.anchoredPosition = new Vector2(-18f + ((REPOElement)component).rectTransform.anchoredPosition.x - 21.94f, ((REPOElement)component).rectTransform.anchoredPosition.y + 4.8f);
				((Component)val2).transform.localPosition = new Vector3(((Component)val2).transform.localPosition.x + 145f, ((Component)val2).transform.localPosition.y);
				REPOButton val3 = MenuAPI.CreateREPOButton("-1", (Action)delegate
				{
					//IL_0054: Unknown result type (might be due to invalid IL or missing references)
					string text = JsonUtility.ToJson((object)new EnemyReportData
					{
						enemyId = (int)data2.enemy * -1,
						reportPlayerName = SemiFunc.PlayerAvatarLocal().playerName,
						steamIDshort = SemiFunc.PlayerAvatarLocal().steamIDshort
					});
					NetworkedEvent? obj2 = onEnemyReportEvent;
					if (obj2 != null)
					{
						obj2.RaiseEvent((object)text, NetworkingEvents.RaiseAll, SendOptions.SendReliable);
					}
				}, ((Component)val).transform, default(Vector2));
				((Component)val3).transform.localPosition = new Vector3(((Component)val3).transform.localPosition.x + 185f, ((Component)val3).transform.localPosition.y);
				val3.menuButton.buttonPitch = 2.06f + -0.06f * (float)num;
				TextMeshProUGUI component2 = Object.Instantiate<GameObject>(((Component)val2.labelTMP).gameObject, ((Component)val3).transform).GetComponent<TextMeshProUGUI>();
				((TMP_Text)component2).horizontalAlignment = (HorizontalAlignmentOptions)4;
				((TMP_Text)component2).transform.localPosition = new Vector3(28.06f, 0f);
				enemyCountTable[(int)data2.enemy].txt_ReportCount = component2;
				enemyCountTable[(int)data2.enemy].UpdateText();
				enemyIndex++;
				return ((REPOElement)val).rectTransform;
			}, 0f, 0f);
		}

		private void AddStrengthElement(EnemyData.Data data, TextMeshProUGUI? strength_title_label_tmp)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			EnemyData.Data data2 = data;
			TextMeshProUGUI strength_title_label_tmp2 = strength_title_label_tmp;
			string enemy_name = data2.GetEnemyName();
			REPOPopupPage? obj = enemyReportPopup;
			if (obj == null)
			{
				return;
			}
			obj.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform parent)
			{
				//IL_0086: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_016e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0184: Unknown result type (might be due to invalid IL or missing references)
				//IL_0194: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0202: Unknown result type (might be due to invalid IL or missing references)
				//IL_0225: Unknown result type (might be due to invalid IL or missing references)
				//IL_0235: Unknown result type (might be due to invalid IL or missing references)
				data2.strengthTitleLabelTMP = strength_title_label_tmp2;
				bool flag = data2.strength >= 0 && selfStrength >= data2.strength;
				REPOButton val = MenuAPI.CreateREPOButton(string.Format("{0} {1}({2})</color>", enemy_name, flag ? "<color=orange>" : "<color=#808080>", (data2.strength >= 0) ? ((object)data2.strength) : "Impossible"), (Action)null, parent, default(Vector2));
				((TMP_Text)val.labelTMP).fontSize = 24f;
				data2.strengthLabelTMP = val.labelTMP;
				((REPOElement)val).rectTransform.anchoredPosition = new Vector2(((REPOElement)val).rectTransform.anchoredPosition.x + 21.38f + 2.78f + 3.18f, ((REPOElement)val).rectTransform.anchoredPosition.y);
				int num = strengthIndex;
				val.menuButton.buttonPitch = 2.06f + -0.06f * (float)num;
				REPOButton component = Object.Instantiate<GameObject>(((Component)val).gameObject, (Transform)(object)((REPOElement)val).rectTransform).GetComponent<REPOButton>();
				TextMeshProUGUI[] componentsInChildren = ((Component)component).GetComponentsInChildren<TextMeshProUGUI>();
				if (componentsInChildren != null)
				{
					for (int i = 0; i < componentsInChildren.Length; i++)
					{
						((TMP_Text)componentsInChildren[i]).SetText("", true);
					}
				}
				((REPOElement)component).rectTransform.sizeDelta = new Vector2(((REPOElement)val).rectTransform.sizeDelta.y * 0.75f, ((REPOElement)val).rectTransform.sizeDelta.y * 0.75f);
				((Graphic)((Selectable)component.button).image).color = Color.white;
				((Graphic)((Selectable)component.button).image).raycastTarget = false;
				((Selectable)component.button).image.sprite = LoadSprite(data2.enemy.GetResourceName());
				((REPOElement)component).rectTransform.anchoredPosition = new Vector2(-18f + ((REPOElement)component).rectTransform.anchoredPosition.x - 21.94f - 9.76f - 9.76f, ((REPOElement)component).rectTransform.anchoredPosition.y + 4.8f);
				Object.Destroy((Object)(object)((Component)component).GetComponent<MenuButton>());
				Object.Destroy((Object)(object)component);
				strengthIndex++;
				return ((REPOElement)val).rectTransform;
			}, 0f, 0f);
		}

		private void UpdateEnemyReportInfoText()
		{
			REPOLabel? obj = txt_EnemyReportInfo;
			if (obj != null)
			{
				((TMP_Text)obj.labelTMP).SetText("", true);
			}
			if (!SemiFunc.RunIsLevel())
			{
				return;
			}
			bool flag = false;
			foreach (EnemyData.Enemy value in Enum.GetValues(typeof(EnemyData.Enemy)))
			{
				if (value.IsTier1() && enemyCountTable.ContainsKey((int)value) && enemyCountTable[(int)value].reportCount > 0)
				{
					flag = true;
					break;
				}
			}
			bool flag2 = false;
			foreach (EnemyData.Enemy value2 in Enum.GetValues(typeof(EnemyData.Enemy)))
			{
				if (value2.IsTier2() && enemyCountTable.ContainsKey((int)value2) && enemyCountTable[(int)value2].reportCount > 0)
				{
					flag2 = true;
					break;
				}
			}
			bool flag3 = false;
			foreach (EnemyData.Enemy value3 in Enum.GetValues(typeof(EnemyData.Enemy)))
			{
				if (value3.IsTier3() && enemyCountTable.ContainsKey((int)value3) && enemyCountTable[(int)value3].reportCount > 0)
				{
					flag3 = true;
					break;
				}
			}
			int num = 0;
			string arg = "";
			StringBuilder stringBuilder = new StringBuilder();
			foreach (KeyValuePair<int, EnemyReportInfo> item in enemyCountTable)
			{
				int num2 = -1;
				EnemyData.Enemy key = (EnemyData.Enemy)item.Key;
				if (key.IsTier1())
				{
					num2 = 1;
				}
				else if (key.IsTier2())
				{
					num2 = 2;
				}
				else if (key.IsTier3())
				{
					num2 = 3;
				}
				if (num != num2)
				{
					num = num2;
					if ((num2 == 1 && flag) || (num2 == 2 && flag2) || (num2 == 3 && flag3))
					{
						switch (num2)
						{
						case 1:
							arg = "#00FFFF";
							break;
						case 2:
							arg = "yellow";
							break;
						case 3:
							arg = "red";
							break;
						}
						stringBuilder.AppendLine($"<color={arg}>[Tier{num2}]</color>");
					}
				}
				string name = Enum.GetName(typeof(EnemyData.Enemy), (EnemyData.Enemy)item.Key);
				if (item.Value.reportCount > 0)
				{
					stringBuilder.AppendLine($"<color={arg}>{name} : {item.Value.reportCount}</color>");
				}
			}
			if (stringBuilder.Length == 0)
			{
				stringBuilder.Append("No Reports.");
			}
			REPOLabel? obj2 = txt_EnemyReportInfo;
			if (obj2 != null)
			{
				((TMP_Text)obj2.labelTMP).SetText(stringBuilder.ToString(), true);
			}
		}

		private void SetReportAnimation(EnemyReportAnimation animation)
		{
			reportAnimation = animation;
			reportAnimationTime = GetReportAnimationTime(animation);
		}

		private float GetReportAnimationTime(EnemyReportAnimation animation)
		{
			return reportAnimation switch
			{
				EnemyReportAnimation.None => 0f, 
				EnemyReportAnimation.Begin => noticeFadeBeginTime.Value, 
				EnemyReportAnimation.Loop => noticeWaitTime.Value, 
				EnemyReportAnimation.End => noticeFadeEndTime.Value, 
				_ => 0f, 
			};
		}

		private Color ChangeColorAlpha(Color color, float alpha)
		{
			//IL_0000: 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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return new Color(color.r, color.g, color.b, Mathf.Clamp01(alpha));
		}

		private Sprite? LoadSprite(string resource_name, int pixels_per_unit = 100)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			using Stream stream = executingAssembly.GetManifestResourceStream(resource_name);
			if (stream == null)
			{
				Debug.LogError((object)("[EnemyReporter] Resource not found: " + resource_name));
				return null;
			}
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			ImageConversion.LoadImage(val, array);
			((Texture)val).filterMode = (FilterMode)1;
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), (float)pixels_per_unit);
		}

		private void ClearScrollElements(REPOPopupPage? page)
		{
			if ((Object)(object)page == (Object)null || (Object)(object)page.menuScrollBox == (Object)null || (Object)(object)page.menuScrollBox.scroller == (Object)null)
			{
				return;
			}
			for (int num = ((Transform)page.menuScrollBox.scroller).childCount - 1; num >= 0; num--)
			{
				if (!((Object)((Component)((Transform)page.menuScrollBox.scroller).GetChild(num)).gameObject).name.Contains("[ALWAYS"))
				{
					Object.Destroy((Object)(object)((Component)((Transform)page.menuScrollBox.scroller).GetChild(num)).gameObject);
				}
			}
		}

		private void CreateEnemyReportPopup()
		{
			ClearScrollElements(enemyReportPopup);
			enemyReportPopup.menuScrollBox.Update();
			enemyIndex = 0;
			List<EnemyData.Data> list = new List<EnemyData.Data>(EnemyData.datas);
			list.Sort((EnemyData.Data l, EnemyData.Data r) => l.enemy - r.enemy);
			foreach (EnemyData.Data item in list)
			{
				AddEnemyReportElement(item);
			}
		}

		private void CreateStrengthPopup()
		{
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			ClearScrollElements(enemyReportPopup);
			strengthIndex = 0;
			enemyStrengthDataList.Clear();
			List<EnemyData.Data> list = new List<EnemyData.Data>(EnemyData.datas);
			list.Sort(delegate(EnemyData.Data l, EnemyData.Data r)
			{
				int strength = l.strength;
				int strength2 = r.strength;
				int num = strength - strength2;
				if (num != 0)
				{
					return num;
				}
				strength = (l.enemy.IsTier1() ? 1 : (l.enemy.IsTier2() ? 2 : 3));
				strength2 = (r.enemy.IsTier1() ? 1 : (r.enemy.IsTier2() ? 2 : 3));
				num = strength - strength2;
				return (num != 0) ? num : (l.enemy - r.enemy);
			});
			int now_strength = int.MaxValue;
			foreach (EnemyData.Data item in list)
			{
				TextMeshProUGUI strength_title_label_tmp = null;
				if (now_strength != item.strength)
				{
					now_strength = item.strength;
					REPOPopupPage? obj = enemyReportPopup;
					if (obj != null)
					{
						obj.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform parent)
						{
							//IL_0073: Unknown result type (might be due to invalid IL or missing references)
							//IL_0079: Unknown result type (might be due to invalid IL or missing references)
							bool flag = now_strength >= 0 && selfStrength >= now_strength;
							REPOLabel val = MenuAPI.CreateREPOLabel(string.Format("<color=white>Strength: {0}{1}</color></color>", flag ? "<color=orange>" : "<color=#808080>", (now_strength >= 0) ? ((object)now_strength) : "Impossible"), parent, default(Vector2));
							TextMeshProUGUI labelTMP = val.labelTMP;
							((TMP_Text)labelTMP).fontSize = ((TMP_Text)labelTMP).fontSize - 8f;
							strength_title_label_tmp = val.labelTMP;
							return ((REPOElement)val).rectTransform;
						}, 0f, 0f);
					}
				}
				enemyStrengthDataList.Add(item);
				AddStrengthElement(item, strength_title_label_tmp);
			}
		}

		private void CreateSpawnPopup()
		{
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_00ea: Expected O, but got Unknown
			ClearScrollElements(enemyReportPopup);
			enemySpawnDataList.Clear();
			enemySpawnDataList.Add(new EnemyData.SpawnData(1, 2, 1, 0, 1));
			enemySpawnDataList.Add(new EnemyData.SpawnData(3, 5, 1, 1, 1));
			enemySpawnDataList.Add(new EnemyData.SpawnData(6, 8, 2, 2, 2));
			enemySpawnDataList.Add(new EnemyData.SpawnData(9, 9, 2, 3, 2));
			enemySpawnDataList.Add(new EnemyData.SpawnData(10, 19, 2, 3, 3));
			enemySpawnDataList.Add(new EnemyData.SpawnData(20, int.MaxValue, 3, 4, 4));
			int i = -1;
			int count = enemySpawnDataList.Count;
			ScrollViewBuilderDelegate val = default(ScrollViewBuilderDelegate);
			while (i < count)
			{
				REPOPopupPage? obj = enemyReportPopup;
				if (obj != null)
				{
					ScrollViewBuilderDelegate obj2 = val;
					if (obj2 == null)
					{
						ScrollViewBuilderDelegate val2 = delegate(Transform parent)
						{
							//IL_0024: Unknown result type (might be due to invalid IL or missing references)
							//IL_0053: Unknown result type (might be due to invalid IL or missing references)
							//IL_0082: Unknown result type (might be due to invalid IL or missing references)
							//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
							//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
							//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
							//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
							//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
							REPOLabel val4 = MenuAPI.CreateREPOLabel("", parent, new Vector2(-149.7091f, 184.3624f - 29.298096f * (float)Mathf.Max(0, i)));
							REPOLabel val5 = MenuAPI.CreateREPOLabel("", parent, new Vector2(1.700119f, 184.3624f - 29.298096f * (float)Mathf.Max(0, i)));
							REPOLabel val6 = MenuAPI.CreateREPOLabel("", parent, new Vector2(65.90404f, 184.3624f - 29.298096f * (float)Mathf.Max(0, i)));
							REPOLabel val7 = MenuAPI.CreateREPOLabel("", parent, new Vector2(127.00602f, 184.3624f - 29.298096f * (float)Mathf.Max(0, i)));
							((Graphic)val4.labelTMP).color = Color.white;
							((Graphic)val5.labelTMP).color = Color.white;
							((Graphic)val6.labelTMP).color = Color.white;
							((Graphic)val7.labelTMP).color = Color.white;
							if (i != -1)
							{
								enemySpawnDataList[i].SetSpawnText(val4.labelTMP, val5.labelTMP, val6.labelTMP, val7.labelTMP);
								enemySpawnDataList[i].UpdateText();
							}
							return ((REPOElement)val4).rectTransform;
						};
						ScrollViewBuilderDelegate val3 = val2;
						val = val2;
						obj2 = val3;
					}
					obj.AddElementToScrollView(obj2, 0f, 0f);
				}
				int num = i + 1;
				i = num;
			}
		}

		private void UpdateHeader()
		{
			switch (tab)
			{
			case Tab.Report:
				((TMP_Text)headerLabelTMP).SetText("Enemy Report", true);
				break;
			case Tab.Strength:
				((TMP_Text)headerLabelTMP).SetText($"Strength to Throw ({selfStrength})", true);
				break;
			case Tab.Spawn:
				((TMP_Text)headerLabelTMP).SetText($"Enemy Spawn Info ({RunManager.instance.levelsCompleted + 1})", true);
				break;
			}
			int i = 0;
			for (int count = spawnHeaderObjectList.Count; i < count; i++)
			{
				spawnHeaderObjectList[i].SetActive(tab == Tab.Spawn);
			}
		}

		private IEnumerator SelectTab(Tab tab, Action action = null)
		{
			if (this.tab == tab)
			{
				action?.Invoke();
				yield break;
			}
			switch (this.tab)
			{
			case Tab.Report:
				reportBackupPosition = t_Scroller.localPosition.y;
				reportBackupPosition2 = t_Handle.localPosition.y;
				break;
			case Tab.Strength:
				strengthBackupPosition = t_Scroller.localPosition.y;
				strengthBackupPosition2 = t_Handle.localPosition.y;
				break;
			}
			this.tab = tab;
			yield return null;
			yield return null;
			yield return null;
			switch (tab)
			{
			case Tab.Report:
				CreateEnemyReportPopup();
				yield return null;
				yield return null;
				yield return null;
				if (reportBackupPosition.HasValue && reportBackupPosition2.HasValue)
				{
					t_Scroller.localPosition = new Vector3(t_Scroller.localPosition.x, reportBackupPosition.Value, t_Scroller.localPosition.z);
					t_Handle.localPosition = new Vector3(t_Handle.localPosition.x, reportBackupPosition2.Value, t_Handle.localPosition.z);
					((Component)enemyReportPopup.menuScrollBox.scrollHandle).transform.localPosition = t_Handle.localPosition;
					REPOReflection.menuScrollBox_ScrollHandleTargetPosition.SetValue(enemyReportPopup.menuScrollBox, t_Handle.localPosition.y);
				}
				break;
			case Tab.Strength:
				CreateStrengthPopup();
				yield return null;
				yield return null;
				yield return null;
				if (strengthBackupPosition.HasValue && strengthBackupPosition2.HasValue)
				{
					t_Scroller.localPosition = new Vector3(t_Scroller.localPosition.x, strengthBackupPosition.Value, t_Scroller.localPosition.z);
					t_Handle.localPosition = new Vector3(t_Handle.localPosition.x, strengthBackupPosition2.Value, t_Handle.localPosition.z);
					((Component)enemyReportPopup.menuScrollBox.scrollHandle).transform.localPosition = t_Handle.localPosition;
					REPOReflection.menuScrollBox_ScrollHandleTargetPosition.SetValue(enemyReportPopup.menuScrollBox, t_Handle.localPosition.y);
				}
				break;
			case Tab.Spawn:
				CreateSpawnPopup();
				yield return null;
				yield return null;
				yield return null;
				break;
			}
			UpdateHeader();
			UpdateButtonTexts();
			action?.Invoke();
		}

		private void UpdateButtonTexts()
		{
			if ((Object)(object)btn_Report != (Object)null)
			{
				((TMP_Text)btn_Report.labelTMP).SetText((tab == Tab.Report) ? "<color=orange>Report</color>" : "Report", true);
			}
			if ((Object)(object)btn_Strength != (Object)null)
			{
				((TMP_Text)btn_Strength.labelTMP).SetText((tab == Tab.Strength) ? "<color=orange>Strength</color>" : "Strength", true);
			}
			if ((Object)(object)btn_Spawn != (Object)null)
			{
				((TMP_Text)btn_Spawn.labelTMP).SetText((tab == Tab.Spawn) ? "<color=orange>Spawn</color>" : "Spawn", true);
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "miru-y.EnemyReport";

		public const string PLUGIN_NAME = "EnemyReport";

		public const string PLUGIN_VERSION = "1.3.1";
	}
}
namespace EnemyReport.Patches
{
	[HarmonyPatch(typeof(MoonUI))]
	internal sealed class MoonUIPatch
	{
		[HarmonyPatch("Check")]
		[HarmonyPostfix]
		private static void Postfix(MoonUI __instance)
		{
			EnemyReport.instance.ResetEnemyReportInfo();
		}
	}
}