Decompiled source of ManorPvP v1.1.0

ManorPvP.dll

Decompiled 3 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen.Graph;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ManorPvP")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ManorPvP")]
[assembly: AssemblyTitle("ManorPvP")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ManorPvP
{
	public class ManorPvPManager : MonoBehaviour
	{
		public static MatchSettings Settings = MatchSettings.FromConfig();

		private bool matchStarted;

		private bool leftOrbit;

		private bool spawnDone;

		private bool resultSent;

		private bool starting;

		private float landedTimer;

		private float winCheckTimer;

		private int spawnedPlayerCount;

		private bool menuOpen;

		private bool autoOpenedThisOrbit;

		private Rect windowRect = new Rect(0f, 0f, 440f, 560f);

		private Vector2 scroll;

		private GUIStyle titleStyle;

		private GUIStyle boxStyle;

		private GUIStyle bigButton;

		private readonly Dictionary<ShotgunItem, int> ammo = new Dictionary<ShotgunItem, int>();

		private readonly Dictionary<ShotgunItem, int> pendingEchoes = new Dictionary<ShotgunItem, int>();

		private bool inMyFire;

		private float nextShotTime;

		private float reloadEndTime;

		private ShotgunItem heldGun;

		private InputAction fireAction;

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

		private float lastMineTime;

		private static GameObject landminePrefab;

		public static ManorPvPManager Instance { get; private set; }

		public static bool MatchActive
		{
			get
			{
				if ((Object)(object)Instance != (Object)null && Instance.matchStarted && (Object)(object)StartOfRound.Instance != (Object)null)
				{
					return !StartOfRound.Instance.inShipPhase;
				}
				return false;
			}
		}

		private static bool IsHost
		{
			get
			{
				if ((Object)(object)NetworkManager.Singleton != (Object)null)
				{
					return NetworkManager.Singleton.IsServer;
				}
				return false;
			}
		}

		private static PlayerControllerB Local
		{
			get
			{
				if (!((Object)(object)GameNetworkManager.Instance != (Object)null))
				{
					return null;
				}
				return GameNetworkManager.Instance.localPlayerController;
			}
		}

		private void Awake()
		{
			Instance = this;
		}

		public void ResetAll()
		{
			matchStarted = false;
			leftOrbit = false;
			spawnDone = false;
			resultSent = false;
			starting = false;
			autoOpenedThisOrbit = false;
			ammo.Clear();
			pendingEchoes.Clear();
			mineCounts.Clear();
			fireAction = null;
			if (menuOpen)
			{
				SetMenu(open: false);
			}
			((MonoBehaviour)this).StopAllCoroutines();
		}

		private void Update()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.Enabled.Value)
			{
				return;
			}
			StartOfRound instance = StartOfRound.Instance;
			PlayerControllerB local = Local;
			if ((Object)(object)instance == (Object)null || (Object)(object)local == (Object)null)
			{
				if (menuOpen)
				{
					SetMenu(open: false);
				}
				return;
			}
			if (Keyboard.current != null && ((ButtonControl)Keyboard.current[Plugin.MenuKey.Value]).wasPressedThisFrame && !local.isTypingChat)
			{
				SetMenu(!menuOpen);
			}
			if (!instance.inShipPhase)
			{
				leftOrbit = true;
			}
			if (instance.inShipPhase && leftOrbit)
			{
				leftOrbit = false;
				matchStarted = false;
				spawnDone = false;
				resultSent = false;
				autoOpenedThisOrbit = false;
				ammo.Clear();
				pendingEchoes.Clear();
				mineCounts.Clear();
			}
			if (IsHost && instance.inShipPhase && !autoOpenedThisOrbit && !instance.travellingToNewLevel && instance.fullyLoadedPlayers != null)
			{
				autoOpenedThisOrbit = true;
				SetMenu(open: true);
			}
			if (menuOpen)
			{
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
				local.disableLookInput = true;
				local.disableMoveInput = true;
			}
			if (IsHost)
			{
				HostUpdate(instance);
			}
			if (MatchActive)
			{
				GunUpdate(local);
			}
		}

		private void HostUpdate(StartOfRound sor)
		{
			if (!matchStarted || sor.inShipPhase)
			{
				return;
			}
			if (!spawnDone)
			{
				RoundManager instance = RoundManager.Instance;
				if (sor.shipHasLanded && (Object)(object)instance != (Object)null && instance.dungeonFinishedGeneratingForAllPlayers && instance.insideAINodes != null && instance.insideAINodes.Length != 0)
				{
					landedTimer += Time.deltaTime;
					if (landedTimer > 1.5f)
					{
						spawnDone = true;
						DoSpawns();
					}
				}
				else
				{
					landedTimer = 0f;
				}
			}
			else
			{
				if (resultSent || !sor.shipHasLanded)
				{
					return;
				}
				winCheckTimer -= Time.deltaTime;
				if (winCheckTimer > 0f)
				{
					return;
				}
				winCheckTimer = 0.5f;
				List<PlayerControllerB> list = sor.allPlayerScripts.Where((PlayerControllerB p) => (Object)(object)p != (Object)null && p.isPlayerControlled && !p.isPlayerDead).ToList();
				if (spawnedPlayerCount >= 2 && list.Count <= 1)
				{
					resultSent = true;
					Net.BroadcastResult((list.Count == 1) ? (list[0].playerUsername + " KAZANDI!") : "Kimse hayatta kalmadı, berabere!");
					if (Plugin.AutoLeaveOnWin.Value && list.Count == 1)
					{
						((MonoBehaviour)this).StartCoroutine(LeaveAfter(6f));
					}
				}
			}
		}

		private IEnumerator LeaveAfter(float seconds)
		{
			yield return (object)new WaitForSeconds(seconds);
			ForceShipLeave();
		}

		private static void ForceShipLeave()
		{
			StartOfRound instance = StartOfRound.Instance;
			if ((Object)(object)instance != (Object)null && instance.shipHasLanded && !instance.shipIsLeaving)
			{
				instance.EndGameServerRpc((int)Local.playerClientId);
			}
		}

		private List<SelectableLevel> Moons()
		{
			return StartOfRound.Instance.levels.Where((SelectableLevel l) => (Object)(object)l != (Object)null && l.sceneName != "CompanyBuilding" && !l.PlanetName.Contains("Gordion")).ToList();
		}

		private SelectableLevel SelectedMoon()
		{
			List<SelectableLevel> source = Moons();
			return ((IEnumerable<SelectableLevel>)source).FirstOrDefault((Func<SelectableLevel, bool>)((SelectableLevel l) => l.PlanetName == Plugin.MoonName.Value)) ?? ((IEnumerable<SelectableLevel>)source).FirstOrDefault((Func<SelectableLevel, bool>)((SelectableLevel l) => l.PlanetName.Contains(Plugin.MoonName.Value))) ?? source.FirstOrDefault();
		}

		private void StartMatch()
		{
			SelectableLevel val = SelectedMoon();
			if (!((Object)(object)val == (Object)null) && !starting)
			{
				Plugin.Cfg.Save();
				SetMenu(open: false);
				((MonoBehaviour)this).StartCoroutine(StartMatchRoutine(val.levelID));
			}
		}

		private IEnumerator StartMatchRoutine(int levelId)
		{
			starting = true;
			StartOfRound sor = StartOfRound.Instance;
			Net.BroadcastStart(MatchSettings.FromConfig());
			if (sor.currentLevelID != levelId)
			{
				Terminal val = Object.FindObjectOfType<Terminal>();
				sor.ChangeLevelServerRpc(levelId, ((Object)(object)val != (Object)null) ? val.groupCredits : 0);
				float t = 0f;
				yield return (object)new WaitForSeconds(0.5f);
				while ((sor.travellingToNewLevel || sor.currentLevelID != levelId) && t < 40f)
				{
					t += Time.deltaTime;
					yield return null;
				}
				yield return (object)new WaitForSeconds(1f);
			}
			if (sor.currentLevelID != levelId)
			{
				HUDManager.Instance.DisplayTip("Manor PvP", "Aya gidilemedi, tekrar dene.", true, false, "LC_Tip1");
				starting = false;
				yield break;
			}
			landedTimer = 0f;
			spawnDone = false;
			resultSent = false;
			sor.StartGameServerRpc();
			yield return (object)new WaitForSeconds(3f);
			starting = false;
		}

		private void DoSpawns()
		{
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			StartOfRound instance = StartOfRound.Instance;
			List<PlayerControllerB> list = instance.allPlayerScripts.Where((PlayerControllerB p) => (Object)(object)p != (Object)null && p.isPlayerControlled && !p.isPlayerDead).ToList();
			spawnedPlayerCount = list.Count;
			List<Vector3> list2 = PickFarApartPoints(list.Count);
			List<PlayerControllerB> list3 = list.OrderBy((PlayerControllerB _) => Random.value).ToList();
			Item val = (Plugin.GiveGun.Value ? FindItem<ShotgunItem>("Silah") : null);
			Item val2 = ((Plugin.KeyCount.Value > 0) ? FindItem<KeyItem>("Anahtar") : null);
			Item val3 = (Plugin.GiveMineTool.Value ? FindItem<RemoteProp>("Kumanda (mayın koyucu)") : null);
			int num = Mathf.Clamp(Plugin.KeyCount.Value, 0, 2);
			List<SpawnEntry> list4 = new List<SpawnEntry>();
			mineCounts.Clear();
			for (int num2 = 0; num2 < list3.Count; num2++)
			{
				Vector3 val4 = list2[num2 % list2.Count];
				List<ulong> list5 = new List<ulong>();
				if ((Object)(object)val2 != (Object)null)
				{
					for (int num3 = 0; num3 < num; num3++)
					{
						list5.Add(SpawnItem(val2, val4));
					}
				}
				ulong num4 = 0uL;
				if ((Object)(object)val3 != (Object)null)
				{
					num4 = SpawnItem(val3, val4);
					list5.Add(num4);
				}
				if ((Object)(object)val != (Object)null)
				{
					list5.Add(SpawnItem(val, val4));
				}
				list4.Add(new SpawnEntry
				{
					PlayerIndex = Array.IndexOf(instance.allPlayerScripts, list3[num2]),
					Position = val4,
					GrabIds = list5.ToArray(),
					MineToolId = num4
				});
			}
			Net.BroadcastSpawns(list4);
		}

		private static ulong SpawnItem(Item item, Vector3 pos)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Object.Instantiate<GameObject>(item.spawnPrefab, pos + Vector3.up * 0.5f, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer);
			GrabbableObject component = obj.GetComponent<GrabbableObject>();
			component.fallTime = 0f;
			component.isInFactory = true;
			NetworkObject component2 = obj.GetComponent<NetworkObject>();
			component2.Spawn(false);
			return component2.NetworkObjectId;
		}

		private static Item FindItem<T>(string label) where T : GrabbableObject
		{
			Item? obj = ((IEnumerable<Item>)StartOfRound.Instance.allItemsList.itemsList).FirstOrDefault((Func<Item, bool>)((Item i) => (Object)(object)i != (Object)null && (Object)(object)i.spawnPrefab != (Object)null && (Object)(object)i.spawnPrefab.GetComponent<T>() != (Object)null));
			if ((Object)(object)obj == (Object)null)
			{
				Plugin.Log.LogWarning((object)(label + " eşyası bulunamadı!"));
			}
			return obj;
		}

		private static GameObject FindLandminePrefab()
		{
			if ((Object)(object)landminePrefab != (Object)null)
			{
				return landminePrefab;
			}
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			foreach (SelectableLevel val in levels)
			{
				if (val?.indoorMapHazards == null)
				{
					continue;
				}
				IndoorMapHazard[] indoorMapHazards = val.indoorMapHazards;
				for (int j = 0; j < indoorMapHazards.Length; j++)
				{
					GameObject val2 = indoorMapHazards[j]?.hazardType?.prefabToSpawn;
					if ((Object)(object)val2 != (Object)null && (Object)(object)val2.GetComponentInChildren<Landmine>() != (Object)null)
					{
						return landminePrefab = val2;
					}
				}
			}
			Plugin.Log.LogWarning((object)"Mayın prefab'ı bulunamadı!");
			return null;
		}

		public void TryPlaceMine(GrabbableObject tool)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB local = Local;
			if ((Object)(object)local == (Object)null || (Object)(object)tool.playerHeldBy != (Object)(object)local || local.isPlayerDead || Time.time - lastMineTime < 1f)
			{
				return;
			}
			if (!mineCounts.TryGetValue(((NetworkBehaviour)tool).NetworkObjectId, out var value) || value <= 0)
			{
				HUDManager.Instance.DisplayTip("Mayın", "Mayının kalmadı!", true, false, "LC_Tip1");
				return;
			}
			Transform transform = ((Component)local).transform;
			Vector3 val = Vector3.ProjectOnPlane(((Component)local.gameplayCamera).transform.forward, Vector3.up);
			Vector3 val2 = ((Vector3)(ref val)).normalized;
			if (((Vector3)(ref val2)).sqrMagnitude < 0.01f)
			{
				val2 = transform.forward;
			}
			Vector3 val3 = transform.position + Vector3.up * 1f;
			Vector3 val4 = transform.position + val2 * 1.5f + Vector3.up * 1f;
			int collidersAndRoomMaskAndDefault = StartOfRound.Instance.collidersAndRoomMaskAndDefault;
			RaycastHit val5 = default(RaycastHit);
			if (Physics.Linecast(val3, val4, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) || !Physics.Raycast(val4, Vector3.down, ref val5, 3f, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
			{
				HUDManager.Instance.DisplayTip("Mayın", "Buraya mayın koyulamaz.", true, false, "LC_Tip1");
				return;
			}
			lastMineTime = Time.time;
			Quaternion val6 = Quaternion.LookRotation(val2);
			float y = ((Quaternion)(ref val6)).eulerAngles.y;
			Net.RequestPlaceMine(((NetworkBehaviour)tool).NetworkObjectId, ((RaycastHit)(ref val5)).point, y);
		}

		public void HostPlaceMine(ulong sender, ulong toolId, Vector3 pos, float yaw)
		{
			//IL_005c: 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)
			if (MatchActive && mineCounts.TryGetValue(toolId, out var value) && value > 0 && NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(toolId, out var value2) && value2.OwnerClientId == sender)
			{
				GameObject val = FindLandminePrefab();
				if (!((Object)(object)val == (Object)null))
				{
					GameObject val2 = GameObject.FindGameObjectWithTag("MapPropsContainer");
					Object.Instantiate<GameObject>(val, pos, Quaternion.Euler(0f, yaw, 0f), ((Object)(object)val2 != (Object)null) ? val2.transform : null).GetComponent<NetworkObject>().Spawn(true);
					Net.BroadcastMineCount(toolId, value - 1);
				}
			}
		}

		public void OnMineCount(ulong toolId, int remaining)
		{
			mineCounts[toolId] = remaining;
		}

		public bool IsMineTool(GrabbableObject item)
		{
			if ((Object)(object)item != (Object)null && (Object)(object)((NetworkBehaviour)item).NetworkObject != (Object)null)
			{
				return mineCounts.ContainsKey(((NetworkBehaviour)item).NetworkObjectId);
			}
			return false;
		}

		private static List<Vector3> PickFarApartPoints(int count)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3> list = new List<Vector3>();
			GameObject[] insideAINodes = RoundManager.Instance.insideAINodes;
			NavMeshHit val2 = default(NavMeshHit);
			foreach (GameObject val in insideAINodes)
			{
				if (!((Object)(object)val == (Object)null) && NavMesh.SamplePosition(val.transform.position, ref val2, 3f, -1))
				{
					list.Add(((NavMeshHit)(ref val2)).position);
				}
			}
			if (list.Count == 0)
			{
				list.Add(RoundManager.Instance.insideAINodes[0].transform.position);
			}
			List<Vector3> list2 = new List<Vector3> { list[Random.Range(0, list.Count)] };
			while (list2.Count < count && list2.Count < list.Count)
			{
				Vector3 item = list[0];
				float num = -1f;
				foreach (Vector3 c in list)
				{
					float num2 = list2.Min((Vector3 x) => Vector3.Distance(x, c));
					if (num2 > num)
					{
						num = num2;
						item = c;
					}
				}
				list2.Add(item);
			}
			return list2;
		}

		public void OnMatchStart(MatchSettings s)
		{
			Settings = s;
			matchStarted = true;
			ammo.Clear();
			pendingEchoes.Clear();
			mineCounts.Clear();
			HUDManager instance = HUDManager.Instance;
			if (instance != null)
			{
				instance.DisplayTip("Manor PvP", "Maç başlıyor! Gemi malikaneye iniyor...", false, false, "LC_Tip1");
			}
		}

		public void OnSpawns(List<SpawnEntry> entries)
		{
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			StartOfRound instance = StartOfRound.Instance;
			PlayerControllerB local = Local;
			AudioReverbPresets val = Object.FindObjectOfType<AudioReverbPresets>();
			foreach (SpawnEntry entry in entries)
			{
				if (entry.PlayerIndex < 0 || entry.PlayerIndex >= instance.allPlayerScripts.Length)
				{
					continue;
				}
				PlayerControllerB val2 = instance.allPlayerScripts[entry.PlayerIndex];
				val2.isInElevator = false;
				val2.isInHangarShipRoom = false;
				val2.isInsideFactory = true;
				val2.averageVelocity = 0f;
				val2.velocityLastFrame = Vector3.zero;
				try
				{
					if ((Object)(object)val != (Object)null && val.audioPresets.Length > 2)
					{
						val.audioPresets[2].ChangeAudioReverbForPlayer(val2);
					}
				}
				catch
				{
				}
				val2.TeleportPlayer(entry.Position, false, 0f, false, true);
				ParticleSystem beamOutParticle = val2.beamOutParticle;
				if (beamOutParticle != null)
				{
					beamOutParticle.Play();
				}
				if (entry.MineToolId != 0L)
				{
					mineCounts[entry.MineToolId] = Settings.MinesPerPlayer;
				}
				if ((Object)(object)val2 == (Object)(object)local)
				{
					HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
					HUDManager.Instance.DisplayTip("Manor PvP", "Son hayatta kalan kazanır! Sol tık basılı tut = ateş. Kumanda elindeyken sol tık = mayın.", false, false, "LC_Tip1");
					if (entry.GrabIds != null && entry.GrabIds.Length != 0)
					{
						((MonoBehaviour)this).StartCoroutine(GrabItemsRoutine(entry.GrabIds));
					}
				}
			}
		}

		public void OnResult(string text)
		{
			HUDManager instance = HUDManager.Instance;
			if (instance != null)
			{
				instance.DisplayTip("MAÇ BİTTİ", text, false, false, "LC_Tip1");
			}
			Plugin.Log.LogInfo((object)("Maç sonucu: " + text));
		}

		private IEnumerator GrabItemsRoutine(ulong[] ids)
		{
			yield return (object)new WaitForSeconds(0.5f);
			foreach (ulong id in ids)
			{
				NetworkObject no = null;
				float t = 0f;
				while (t < 8f && !NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(id, out no))
				{
					t += Time.deltaTime;
					yield return null;
				}
				if ((Object)(object)no == (Object)null)
				{
					continue;
				}
				PlayerControllerB local = Local;
				GrabbableObject item = ((Component)no).GetComponent<GrabbableObject>();
				if ((Object)(object)local == (Object)null || local.isPlayerDead)
				{
					break;
				}
				if (!((Object)(object)item == (Object)null) && !item.isHeld && !item.heldByPlayerOnServer)
				{
					t = 0f;
					while ((local.isGrabbingObjectAnimation || local.inSpecialInteractAnimation || local.twoHanded) && t < 5f)
					{
						t += Time.deltaTime;
						yield return null;
					}
					ForceGrab(local, item);
					t = 0f;
					while ((local.isGrabbingObjectAnimation || !item.isHeld) && t < 4f)
					{
						t += Time.deltaTime;
						yield return null;
					}
					yield return (object)new WaitForSeconds(0.25f);
				}
			}
		}

		private static void ForceGrab(PlayerControllerB p, GrabbableObject item)
		{
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			if (item.grabbable && p.FirstEmptyItemSlot(item) != -1 && ((NetworkBehaviour)item).NetworkObject.IsSpawned)
			{
				p.currentlyGrabbingObject = item;
				p.grabInvalidated = false;
				item.InteractItem();
				p.playerBodyAnimator.SetBool("GrabInvalidated", false);
				p.playerBodyAnimator.SetBool("GrabValidated", false);
				p.playerBodyAnimator.SetBool("cancelHolding", false);
				p.playerBodyAnimator.ResetTrigger("Throw");
				p.SetSpecialGrabAnimationBool(true, (GrabbableObject)null);
				p.isGrabbingObjectAnimation = true;
				((Behaviour)p.cursorIcon).enabled = false;
				((TMP_Text)p.cursorTip).text = "";
				p.twoHanded = item.itemProperties.twoHanded;
				p.carryWeight = Mathf.Clamp(p.carryWeight + (item.itemProperties.weight - 1f), 1f, 10f);
				StartOfRound.Instance.SendChangedWeightEvent();
				p.grabObjectAnimationTime = ((item.itemProperties.grabAnimationTime > 0f) ? item.itemProperties.grabAnimationTime : 0.4f);
				p.GrabObjectServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)item).NetworkObject));
				if (p.grabObjectCoroutine != null)
				{
					((MonoBehaviour)p).StopCoroutine(p.grabObjectCoroutine);
				}
				p.grabObjectCoroutine = ((MonoBehaviour)p).StartCoroutine(p.GrabObject());
			}
		}

		private void GunUpdate(PlayerControllerB local)
		{
			GrabbableObject currentlyHeldObjectServer = local.currentlyHeldObjectServer;
			ShotgunItem val = (ShotgunItem)(object)((currentlyHeldObjectServer is ShotgunItem) ? currentlyHeldObjectServer : null);
			if ((Object)(object)val == (Object)null || !((GrabbableObject)val).isHeld || (Object)(object)((GrabbableObject)val).playerHeldBy != (Object)(object)local || ((GrabbableObject)val).isPocketed || local.isPlayerDead)
			{
				heldGun = null;
				return;
			}
			if ((Object)(object)heldGun != (Object)(object)val)
			{
				heldGun = val;
				reloadEndTime = 0f;
			}
			val.shellsLoaded = 2;
			val.isReloading = false;
			if (!ammo.ContainsKey(val))
			{
				ammo[val] = Settings.MagazineSize;
			}
			if (reloadEndTime > 0f)
			{
				if (Time.time < reloadEndTime)
				{
					return;
				}
				reloadEndTime = 0f;
				ammo[val] = Settings.MagazineSize;
				if ((Object)(object)val.gunReloadFinishSFX != (Object)null)
				{
					val.gunAudio.PlayOneShot(val.gunReloadFinishSFX);
				}
			}
			if (!FirePressed() || !CanUseInput(local) || Time.time < nextShotTime)
			{
				return;
			}
			if (!Settings.InfiniteAmmo && ammo[val] <= 0)
			{
				StartReload(val);
				return;
			}
			Fire(val);
			nextShotTime = Time.time + 1f / Settings.FireRate;
			if (!Settings.InfiniteAmmo)
			{
				ammo[val]--;
				if (ammo[val] <= 0)
				{
					StartReload(val);
				}
			}
		}

		private void StartReload(ShotgunItem gun)
		{
			reloadEndTime = Time.time + Settings.ReloadTime;
			if ((Object)(object)gun.gunReloadSFX != (Object)null)
			{
				gun.gunAudio.PlayOneShot(gun.gunReloadSFX);
			}
		}

		private void Fire(ShotgunItem gun)
		{
			pendingEchoes.TryGetValue(gun, out var value);
			pendingEchoes[gun] = value + 1;
			inMyFire = true;
			try
			{
				gun.ShootGunAndSync(true);
			}
			finally
			{
				inMyFire = false;
			}
			gun.localClientSendingShootGunRPC = false;
			gun.shellsLoaded = 2;
		}

		public bool ConsumeEcho(ShotgunItem gun)
		{
			if (inMyFire || !((NetworkBehaviour)gun).IsOwner)
			{
				return false;
			}
			if (pendingEchoes.TryGetValue(gun, out var value) && value > 0)
			{
				pendingEchoes[gun] = value - 1;
				return true;
			}
			return false;
		}

		private bool FirePressed()
		{
			if (fireAction == null)
			{
				IngamePlayerSettings instance = IngamePlayerSettings.Instance;
				if ((Object)(object)instance == (Object)null || (Object)(object)instance.playerInput == (Object)null)
				{
					return false;
				}
				fireAction = instance.playerInput.actions.FindAction("ActivateItem", false);
				if (fireAction == null)
				{
					return false;
				}
			}
			return fireAction.IsPressed();
		}

		private bool CanUseInput(PlayerControllerB p)
		{
			if (!menuOpen && !p.isTypingChat && !p.inTerminalMenu && !p.quickMenuManager.isMenuOpen && !p.inSpecialInteractAnimation)
			{
				return !p.isGrabbingObjectAnimation;
			}
			return false;
		}

		private void SetMenu(bool open)
		{
			if (menuOpen == open)
			{
				return;
			}
			menuOpen = open;
			PlayerControllerB local = Local;
			if (!open)
			{
				Plugin.Cfg.Save();
				if ((Object)(object)local != (Object)null)
				{
					local.disableLookInput = false;
					local.disableMoveInput = false;
					if (!local.quickMenuManager.isMenuOpen && !local.inTerminalMenu)
					{
						Cursor.lockState = (CursorLockMode)1;
						Cursor.visible = false;
					}
				}
			}
			else
			{
				((Rect)(ref windowRect)).x = ((float)Screen.width - ((Rect)(ref windowRect)).width) / 2f;
				((Rect)(ref windowRect)).y = ((float)Screen.height - ((Rect)(ref windowRect)).height) / 2f;
			}
		}

		private void InitStyles()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_005f: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			if (titleStyle == null)
			{
				titleStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 18,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4
				};
				boxStyle = new GUIStyle(GUI.skin.box)
				{
					fontSize = 14,
					alignment = (TextAnchor)4,
					wordWrap = true
				};
				bigButton = new GUIStyle(GUI.skin.button)
				{
					fontSize = 16,
					fontStyle = (FontStyle)1,
					fixedHeight = 40f
				};
			}
		}

		private void OnGUI()
		{
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Expected O, but got Unknown
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.Enabled.Value || (Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)Local == (Object)null)
			{
				return;
			}
			InitStyles();
			StartOfRound instance = StartOfRound.Instance;
			GrabbableObject currentlyHeldObjectServer = Local.currentlyHeldObjectServer;
			if (MatchActive && !Local.isPlayerDead && IsMineTool(currentlyHeldObjectServer))
			{
				GUI.Box(new Rect((float)(Screen.width - 300), (float)(Screen.height - 70), 280f, 40f), $"Mayın: {mineCounts[((NetworkBehaviour)currentlyHeldObjectServer).NetworkObjectId]}  (sol tık: önüne koy)", boxStyle);
			}
			if (MatchActive && (Object)(object)heldGun != (Object)null && !Local.isPlayerDead)
			{
				int value;
				string text = ((reloadEndTime > 0f) ? "Şarjör değiştiriliyor..." : (Settings.InfiniteAmmo ? "Mermi: ∞" : $"Mermi: {(ammo.TryGetValue(heldGun, out value) ? value : 0)} / {Settings.MagazineSize}"));
				GUI.Box(new Rect((float)(Screen.width - 260), (float)(Screen.height - 70), 240f, 40f), text, boxStyle);
			}
			if (!menuOpen)
			{
				if (instance.inShipPhase && !IsHost)
				{
					GUI.Box(new Rect((float)Screen.width / 2f - 220f, 20f, 440f, 34f), "Manor PvP: Host'un maçı başlatması bekleniyor", boxStyle);
				}
			}
			else
			{
				windowRect = GUI.Window(5066830, windowRect, new WindowFunction(DrawWindow), "MANOR PvP");
			}
		}

		private void DrawWindow(int id)
		{
			//IL_00ee: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_061c: Unknown result type (might be due to invalid IL or missing references)
			StartOfRound instance = StartOfRound.Instance;
			GUILayout.Label("Maç Ayarları", titleStyle, Array.Empty<GUILayoutOption>());
			if (!IsHost)
			{
				GUILayout.Space(10f);
				GUILayout.Label("Ayarları sadece host değiştirebilir.", Array.Empty<GUILayoutOption>());
				GUILayout.Label($"Ateş hızı: {Settings.FireRate:0.#}/sn   Hasar: {Settings.Damage}", Array.Empty<GUILayoutOption>());
				GUILayout.Label(Settings.InfiniteAmmo ? "Mermi: sınırsız" : $"Şarjör: {Settings.MagazineSize}  ({Settings.ReloadTime:0.#} sn)", Array.Empty<GUILayoutOption>());
				GUILayout.FlexibleSpace();
				if (GUILayout.Button($"Kapat ({Plugin.MenuKey.Value})", Array.Empty<GUILayoutOption>()))
				{
					SetMenu(open: false);
				}
				GUI.DragWindow();
				return;
			}
			scroll = GUILayout.BeginScrollView(scroll, Array.Empty<GUILayoutOption>());
			List<SelectableLevel> list = Moons();
			SelectableLevel item = SelectedMoon();
			int num = Mathf.Max(0, list.IndexOf(item));
			GUILayout.Space(6f);
			GUILayout.Label("Ay (iç harita her zaman MALİKANE):", Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
			{
				num = (num - 1 + list.Count) % list.Count;
			}
			GUILayout.Label((list.Count > 0) ? list[num].PlanetName : "-", boxStyle, Array.Empty<GUILayoutOption>());
			if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
			{
				num = (num + 1) % list.Count;
			}
			GUILayout.EndHorizontal();
			if (list.Count > 0)
			{
				Plugin.MoonName.Value = list[num].PlanetName;
			}
			GUILayout.Space(10f);
			GUILayout.Label("— Silah —", Array.Empty<GUILayoutOption>());
			Plugin.GiveGun.Value = GUILayout.Toggle(Plugin.GiveGun.Value, " Herkesin eline silah ver", Array.Empty<GUILayoutOption>());
			GUILayout.Label($"Ateş hızı: {Plugin.FireRate.Value:0.#} atış/sn", Array.Empty<GUILayoutOption>());
			Plugin.FireRate.Value = Mathf.Round(GUILayout.HorizontalSlider(Plugin.FireRate.Value, 1f, 15f, Array.Empty<GUILayoutOption>()) * 2f) / 2f;
			GUILayout.Label($"Mermi hasarı: {Plugin.Damage.Value}  (can = 100)", Array.Empty<GUILayoutOption>());
			Plugin.Damage.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)Plugin.Damage.Value, 1f, 100f, Array.Empty<GUILayoutOption>()));
			Plugin.InfiniteAmmo.Value = GUILayout.Toggle(Plugin.InfiniteAmmo.Value, " Sınırsız mermi", Array.Empty<GUILayoutOption>());
			if (!Plugin.InfiniteAmmo.Value)
			{
				GUILayout.Label($"Şarjör: {Plugin.MagazineSize.Value} mermi", Array.Empty<GUILayoutOption>());
				Plugin.MagazineSize.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)Plugin.MagazineSize.Value, 5f, 100f, Array.Empty<GUILayoutOption>()));
				GUILayout.Label($"Şarjör değiştirme: {Plugin.ReloadTime.Value:0.0} sn", Array.Empty<GUILayoutOption>());
				Plugin.ReloadTime.Value = Mathf.Round(GUILayout.HorizontalSlider(Plugin.ReloadTime.Value, 0.5f, 6f, Array.Empty<GUILayoutOption>()) * 10f) / 10f;
			}
			GUILayout.Space(10f);
			GUILayout.Label("— Eşyalar —", Array.Empty<GUILayoutOption>());
			GUILayout.Label($"Anahtar: {Plugin.KeyCount.Value} adet (kilitli kapıları açar)", Array.Empty<GUILayoutOption>());
			Plugin.KeyCount.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)Plugin.KeyCount.Value, 0f, 2f, Array.Empty<GUILayoutOption>()));
			Plugin.GiveMineTool.Value = GUILayout.Toggle(Plugin.GiveMineTool.Value, " Mayın koyucu ver (kumanda)", Array.Empty<GUILayoutOption>());
			if (Plugin.GiveMineTool.Value)
			{
				GUILayout.Label($"Oyuncu başı mayın: {Plugin.MinesPerPlayer.Value}", Array.Empty<GUILayoutOption>());
				Plugin.MinesPerPlayer.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)Plugin.MinesPerPlayer.Value, 1f, 10f, Array.Empty<GUILayoutOption>()));
			}
			GUILayout.Space(10f);
			GUILayout.Label("— Maç —", Array.Empty<GUILayoutOption>());
			Plugin.DisableEnemies.Value = GUILayout.Toggle(Plugin.DisableEnemies.Value, " Canavarları kapat", Array.Empty<GUILayoutOption>());
			Plugin.DisableTraps.Value = GUILayout.Toggle(Plugin.DisableTraps.Value, " Tuzakları kapat (taret, mayın...)", Array.Empty<GUILayoutOption>());
			Plugin.AutoLeaveOnWin.Value = GUILayout.Toggle(Plugin.AutoLeaveOnWin.Value, " Tek kişi kalınca gemi otomatik kalksın", Array.Empty<GUILayoutOption>());
			GUILayout.EndScrollView();
			int num2 = instance.allPlayerScripts.Count((PlayerControllerB p) => (Object)(object)p != (Object)null && p.isPlayerControlled);
			GUILayout.Label($"Bağlı oyuncu: {num2}", Array.Empty<GUILayoutOption>());
			if (instance.inShipPhase)
			{
				GUI.enabled = !starting && !instance.travellingToNewLevel;
				if (GUILayout.Button(starting ? "Başlatılıyor..." : "MAÇI BAŞLAT", bigButton, Array.Empty<GUILayoutOption>()))
				{
					StartMatch();
				}
				GUI.enabled = true;
			}
			else
			{
				GUILayout.Label("Maç devam ediyor.", Array.Empty<GUILayoutOption>());
				GUI.enabled = instance.shipHasLanded && !instance.shipIsLeaving;
				if (GUILayout.Button("Maçı bitir (gemi kalksın)", bigButton, Array.Empty<GUILayoutOption>()))
				{
					SetMenu(open: false);
					ForceShipLeave();
				}
				GUI.enabled = true;
			}
			if (GUILayout.Button($"Kapat ({Plugin.MenuKey.Value})", Array.Empty<GUILayoutOption>()))
			{
				SetMenu(open: false);
			}
			GUI.DragWindow();
		}
	}
	public struct MatchSettings
	{
		public float FireRate;

		public int Damage;

		public bool InfiniteAmmo;

		public int MagazineSize;

		public float ReloadTime;

		public int MinesPerPlayer;

		public static MatchSettings FromConfig()
		{
			return new MatchSettings
			{
				MinesPerPlayer = Mathf.Clamp(Plugin.MinesPerPlayer.Value, 1, 20),
				FireRate = Mathf.Clamp(Plugin.FireRate.Value, 1f, 20f),
				Damage = Mathf.Clamp(Plugin.Damage.Value, 1, 100),
				InfiniteAmmo = Plugin.InfiniteAmmo.Value,
				MagazineSize = Mathf.Clamp(Plugin.MagazineSize.Value, 1, 200),
				ReloadTime = Mathf.Clamp(Plugin.ReloadTime.Value, 0.2f, 10f)
			};
		}
	}
	public struct SpawnEntry
	{
		public int PlayerIndex;

		public Vector3 Position;

		public ulong[] GrabIds;

		public ulong MineToolId;
	}
	internal static class Net
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static HandleNamedMessageDelegate <0>__OnStart;

			public static HandleNamedMessageDelegate <1>__OnSpawn;

			public static HandleNamedMessageDelegate <2>__OnResult;

			public static HandleNamedMessageDelegate <3>__OnPlaceMine;

			public static HandleNamedMessageDelegate <4>__OnMineCount;
		}

		private const string MsgStart = "ManorPvP_Start";

		private const string MsgSpawn = "ManorPvP_Spawn";

		private const string MsgResult = "ManorPvP_Result";

		private const string MsgPlaceMine = "ManorPvP_PlaceMine";

		private const string MsgMineCount = "ManorPvP_MineCount";

		private static readonly string[] AllMessages = new string[5] { "ManorPvP_Start", "ManorPvP_Spawn", "ManorPvP_Result", "ManorPvP_PlaceMine", "ManorPvP_MineCount" };

		private static bool registered;

		public static void Register()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0090: 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_009b: Expected O, but got Unknown
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			NetworkManager singleton = NetworkManager.Singleton;
			if (!((Object)(object)singleton == (Object)null) && singleton.CustomMessagingManager != null && !registered)
			{
				CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager;
				object obj = <>O.<0>__OnStart;
				if (obj == null)
				{
					HandleNamedMessageDelegate val = OnStart;
					<>O.<0>__OnStart = val;
					obj = (object)val;
				}
				customMessagingManager.RegisterNamedMessageHandler("ManorPvP_Start", (HandleNamedMessageDelegate)obj);
				CustomMessagingManager customMessagingManager2 = singleton.CustomMessagingManager;
				object obj2 = <>O.<1>__OnSpawn;
				if (obj2 == null)
				{
					HandleNamedMessageDelegate val2 = OnSpawn;
					<>O.<1>__OnSpawn = val2;
					obj2 = (object)val2;
				}
				customMessagingManager2.RegisterNamedMessageHandler("ManorPvP_Spawn", (HandleNamedMessageDelegate)obj2);
				CustomMessagingManager customMessagingManager3 = singleton.CustomMessagingManager;
				object obj3 = <>O.<2>__OnResult;
				if (obj3 == null)
				{
					HandleNamedMessageDelegate val3 = OnResult;
					<>O.<2>__OnResult = val3;
					obj3 = (object)val3;
				}
				customMessagingManager3.RegisterNamedMessageHandler("ManorPvP_Result", (HandleNamedMessageDelegate)obj3);
				CustomMessagingManager customMessagingManager4 = singleton.CustomMessagingManager;
				object obj4 = <>O.<3>__OnPlaceMine;
				if (obj4 == null)
				{
					HandleNamedMessageDelegate val4 = OnPlaceMine;
					<>O.<3>__OnPlaceMine = val4;
					obj4 = (object)val4;
				}
				customMessagingManager4.RegisterNamedMessageHandler("ManorPvP_PlaceMine", (HandleNamedMessageDelegate)obj4);
				CustomMessagingManager customMessagingManager5 = singleton.CustomMessagingManager;
				object obj5 = <>O.<4>__OnMineCount;
				if (obj5 == null)
				{
					HandleNamedMessageDelegate val5 = OnMineCount;
					<>O.<4>__OnMineCount = val5;
					obj5 = (object)val5;
				}
				customMessagingManager5.RegisterNamedMessageHandler("ManorPvP_MineCount", (HandleNamedMessageDelegate)obj5);
				registered = true;
			}
		}

		public static void Unregister()
		{
			NetworkManager singleton = NetworkManager.Singleton;
			if ((Object)(object)singleton != (Object)null && singleton.CustomMessagingManager != null && registered)
			{
				string[] allMessages = AllMessages;
				foreach (string text in allMessages)
				{
					singleton.CustomMessagingManager.UnregisterNamedMessageHandler(text);
				}
			}
			registered = false;
		}

		private static IReadOnlyList<ulong> OtherClients()
		{
			return NetworkManager.Singleton.ConnectedClientsIds.Where((ulong id) => id != 0).ToList();
		}

		private static void SendToOthers(string name, FastBufferWriter writer)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			IReadOnlyList<ulong> readOnlyList = OtherClients();
			if (readOnlyList.Count > 0)
			{
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(name, readOnlyList, writer, (NetworkDelivery)4);
			}
		}

		public unsafe static void BroadcastStart(MatchSettings s)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_0044: 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_005b: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			FastBufferWriter writer = default(FastBufferWriter);
			((FastBufferWriter)(ref writer))..ctor(64, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref s.FireRate, default(ForPrimitives));
				((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref s.Damage, default(ForPrimitives));
				((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref s.InfiniteAmmo, default(ForPrimitives));
				((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref s.MagazineSize, default(ForPrimitives));
				((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref s.ReloadTime, default(ForPrimitives));
				((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref s.MinesPerPlayer, default(ForPrimitives));
				SendToOthers("ManorPvP_Start", writer);
			}
			finally
			{
				((IDisposable)(*(FastBufferWriter*)(&writer))/*cast due to .constrained prefix*/).Dispose();
			}
			ManorPvPManager.Instance.OnMatchStart(s);
		}

		public unsafe static void BroadcastSpawns(List<SpawnEntry> entries)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_008a: 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)
			FastBufferWriter writer = default(FastBufferWriter);
			((FastBufferWriter)(ref writer))..ctor(256, (Allocator)2, 65536);
			try
			{
				int count = entries.Count;
				((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref count, default(ForPrimitives));
				foreach (SpawnEntry entry in entries)
				{
					SpawnEntry current = entry;
					((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref current.PlayerIndex, default(ForPrimitives));
					((FastBufferWriter)(ref writer)).WriteValueSafe(ref current.Position);
					((FastBufferWriter)(ref writer)).WriteValueSafe<ulong>(current.GrabIds, default(ForPrimitives));
					((FastBufferWriter)(ref writer)).WriteValueSafe<ulong>(ref current.MineToolId, default(ForPrimitives));
				}
				SendToOthers("ManorPvP_Spawn", writer);
			}
			finally
			{
				((IDisposable)(*(FastBufferWriter*)(&writer))/*cast due to .constrained prefix*/).Dispose();
			}
			ManorPvPManager.Instance.OnSpawns(entries);
		}

		public unsafe static void BroadcastResult(string text)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			FastBufferWriter writer = default(FastBufferWriter);
			((FastBufferWriter)(ref writer))..ctor(1024, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref writer)).WriteValueSafe(text, false);
				SendToOthers("ManorPvP_Result", writer);
			}
			finally
			{
				((IDisposable)(*(FastBufferWriter*)(&writer))/*cast due to .constrained prefix*/).Dispose();
			}
			ManorPvPManager.Instance.OnResult(text);
		}

		public unsafe static void BroadcastMineCount(ulong toolId, int remaining)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			FastBufferWriter writer = default(FastBufferWriter);
			((FastBufferWriter)(ref writer))..ctor(16, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref writer)).WriteValueSafe<ulong>(ref toolId, default(ForPrimitives));
				((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref remaining, default(ForPrimitives));
				SendToOthers("ManorPvP_MineCount", writer);
			}
			finally
			{
				((IDisposable)(*(FastBufferWriter*)(&writer))/*cast due to .constrained prefix*/).Dispose();
			}
			ManorPvPManager.Instance.OnMineCount(toolId, remaining);
		}

		public unsafe static void RequestPlaceMine(ulong toolId, Vector3 pos, float yaw)
		{
			//IL_0016: 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_0035: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager singleton = NetworkManager.Singleton;
			if (singleton.IsServer)
			{
				ManorPvPManager.Instance.HostPlaceMine(0uL, toolId, pos, yaw);
				return;
			}
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(32, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref toolId, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe(ref pos);
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref yaw, default(ForPrimitives));
				singleton.CustomMessagingManager.SendNamedMessage("ManorPvP_PlaceMine", 0uL, val, (NetworkDelivery)2);
			}
			finally
			{
				((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose();
			}
		}

		private static void OnPlaceMine(ulong sender, FastBufferReader r)
		{
			//IL_0013: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsServer)
			{
				ulong toolId = default(ulong);
				((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref toolId, default(ForPrimitives));
				Vector3 pos = default(Vector3);
				((FastBufferReader)(ref r)).ReadValueSafe(ref pos);
				float yaw = default(float);
				((FastBufferReader)(ref r)).ReadValueSafe<float>(ref yaw, default(ForPrimitives));
				ManorPvPManager.Instance.HostPlaceMine(sender, toolId, pos, yaw);
			}
		}

		private static void OnMineCount(ulong sender, FastBufferReader r)
		{
			//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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (sender == 0L)
			{
				ulong toolId = default(ulong);
				((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref toolId, default(ForPrimitives));
				int remaining = default(int);
				((FastBufferReader)(ref r)).ReadValueSafe<int>(ref remaining, default(ForPrimitives));
				ManorPvPManager.Instance.OnMineCount(toolId, remaining);
			}
		}

		private static void OnStart(ulong sender, FastBufferReader r)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			if (sender == 0L)
			{
				MatchSettings s = default(MatchSettings);
				((FastBufferReader)(ref r)).ReadValueSafe<float>(ref s.FireRate, default(ForPrimitives));
				((FastBufferReader)(ref r)).ReadValueSafe<int>(ref s.Damage, default(ForPrimitives));
				((FastBufferReader)(ref r)).ReadValueSafe<bool>(ref s.InfiniteAmmo, default(ForPrimitives));
				((FastBufferReader)(ref r)).ReadValueSafe<int>(ref s.MagazineSize, default(ForPrimitives));
				((FastBufferReader)(ref r)).ReadValueSafe<float>(ref s.ReloadTime, default(ForPrimitives));
				((FastBufferReader)(ref r)).ReadValueSafe<int>(ref s.MinesPerPlayer, default(ForPrimitives));
				ManorPvPManager.Instance.OnMatchStart(s);
			}
		}

		private static void OnSpawn(ulong sender, FastBufferReader r)
		{
			//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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if (sender == 0L)
			{
				int num = default(int);
				((FastBufferReader)(ref r)).ReadValueSafe<int>(ref num, default(ForPrimitives));
				List<SpawnEntry> list = new List<SpawnEntry>(num);
				for (int i = 0; i < num; i++)
				{
					SpawnEntry item = default(SpawnEntry);
					((FastBufferReader)(ref r)).ReadValueSafe<int>(ref item.PlayerIndex, default(ForPrimitives));
					((FastBufferReader)(ref r)).ReadValueSafe(ref item.Position);
					((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref item.GrabIds, default(ForPrimitives));
					((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref item.MineToolId, default(ForPrimitives));
					list.Add(item);
				}
				ManorPvPManager.Instance.OnSpawns(list);
			}
		}

		private static void OnResult(ulong sender, FastBufferReader r)
		{
			if (sender == 0L)
			{
				string text = default(string);
				((FastBufferReader)(ref r)).ReadValueSafe(ref text, false);
				ManorPvPManager.Instance.OnResult(text);
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal static class StartOfRoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void Start()
		{
			Net.Register();
			ManorPvPManager.Instance.ResetAll();
		}

		[HarmonyPatch("OnDestroy")]
		[HarmonyPostfix]
		private static void OnDestroy()
		{
			Net.Unregister();
			ManorPvPManager.Instance.ResetAll();
		}
	}
	[HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")]
	internal static class ForceManorPatch
	{
		private static void Prefix(RoundManager __instance, out IntWithRarity[] __state)
		{
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			__state = null;
			if (!Plugin.Enabled.Value || (Object)(object)__instance.currentLevel == (Object)null)
			{
				return;
			}
			int num = -1;
			for (int i = 0; i < __instance.dungeonFlowTypes.Length; i++)
			{
				DungeonFlow val = __instance.dungeonFlowTypes[i]?.dungeonFlow;
				if ((Object)(object)val != (Object)null && (((Object)val).name.Contains("Level2") || ((Object)val).name.ToLower().Contains("manor")))
				{
					num = i;
					break;
				}
			}
			if (num < 0)
			{
				Plugin.Log.LogWarning((object)"Malikane haritası bulunamadı, normal harita kullanılıyor.");
				return;
			}
			__state = __instance.currentLevel.dungeonFlowTypes;
			LevelAmbienceLibrary val2 = null;
			if (__state != null)
			{
				IntWithRarity[] array = __state;
				foreach (IntWithRarity val3 in array)
				{
					if (val3 != null && val3.id == num)
					{
						val2 = val3.overrideLevelAmbience;
					}
				}
			}
			__instance.currentLevel.dungeonFlowTypes = (IntWithRarity[])(object)new IntWithRarity[1]
			{
				new IntWithRarity(num, 100, val2)
			};
		}

		private static void Postfix(RoundManager __instance, IntWithRarity[] __state)
		{
			if (__state != null)
			{
				__instance.currentLevel.dungeonFlowTypes = __state;
			}
		}
	}
	[HarmonyPatch(typeof(StartMatchLever), "LeverAnimation")]
	internal static class BlockLeverPatch
	{
		private static bool Prefix()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.Enabled.Value)
			{
				return true;
			}
			HUDManager instance = HUDManager.Instance;
			if (instance != null)
			{
				instance.DisplayTip("Manor PvP", $"Gemi koldan kullanılamaz. Host oyunu {Plugin.MenuKey.Value} menüsünden başlatır.", true, false, "LC_Tip1");
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal static class SpawnPatches
	{
		private static bool NoEnemies
		{
			get
			{
				if (Plugin.Enabled.Value)
				{
					return Plugin.DisableEnemies.Value;
				}
				return false;
			}
		}

		[HarmonyPatch("AdvanceHourAndSpawnNewBatchOfEnemies")]
		[HarmonyPrefix]
		private static bool AdvanceHour(RoundManager __instance)
		{
			if (!NoEnemies)
			{
				return true;
			}
			__instance.currentHour += __instance.hourTimeBetweenEnemySpawnBatches;
			return false;
		}

		[HarmonyPatch("SpawnEnemiesOutside")]
		[HarmonyPrefix]
		private static bool Outside()
		{
			return !NoEnemies;
		}

		[HarmonyPatch("SpawnDaytimeEnemiesOutside")]
		[HarmonyPrefix]
		private static bool Daytime()
		{
			return !NoEnemies;
		}

		[HarmonyPatch("SpawnMapObjects")]
		[HarmonyPrefix]
		private static bool MapObjects()
		{
			if (Plugin.Enabled.Value)
			{
				return !Plugin.DisableTraps.Value;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(ShotgunItem))]
	internal static class ShotgunPatches
	{
		[HarmonyPatch("ItemActivate")]
		[HarmonyPrefix]
		private static bool ItemActivate()
		{
			return !ManorPvPManager.MatchActive;
		}

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void Update(ShotgunItem __instance)
		{
			if (ManorPvPManager.MatchActive)
			{
				__instance.misfireTimer = 999f;
				__instance.hasHitGroundWithSafetyOff = true;
			}
		}

		[HarmonyPatch("ShootGun")]
		[HarmonyPrefix]
		private static bool ShootGun(ShotgunItem __instance)
		{
			if (!ManorPvPManager.MatchActive)
			{
				return true;
			}
			return !ManorPvPManager.Instance.ConsumeEcho(__instance);
		}
	}
	[HarmonyPatch(typeof(RemoteProp), "ItemActivate")]
	internal static class RemoteActivatePatch
	{
		private static bool Prefix(RemoteProp __instance, bool buttonDown)
		{
			if (!ManorPvPManager.MatchActive || !ManorPvPManager.Instance.IsMineTool((GrabbableObject)(object)__instance))
			{
				return true;
			}
			if (((NetworkBehaviour)__instance).IsOwner && buttonDown)
			{
				ManorPvPManager.Instance.TryPlaceMine((GrabbableObject)(object)__instance);
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")]
	internal static class DamagePatch
	{
		private static void Prefix(ref int damageNumber, CauseOfDeath causeOfDeath)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			if (ManorPvPManager.MatchActive && (int)causeOfDeath == 7 && damageNumber > 0)
			{
				damageNumber = ManorPvPManager.Settings.Damage;
			}
		}
	}
	[BepInPlugin("atilla.ManorPvP", "Manor PvP", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string Guid = "atilla.ManorPvP";

		public const string Name = "Manor PvP";

		public const string Version = "1.1.0";

		internal static ManualLogSource Log;

		internal static ConfigEntry<bool> Enabled;

		internal static ConfigEntry<string> MoonName;

		internal static ConfigEntry<bool> GiveGun;

		internal static ConfigEntry<float> FireRate;

		internal static ConfigEntry<int> Damage;

		internal static ConfigEntry<bool> InfiniteAmmo;

		internal static ConfigEntry<int> MagazineSize;

		internal static ConfigEntry<float> ReloadTime;

		internal static ConfigEntry<int> KeyCount;

		internal static ConfigEntry<bool> GiveMineTool;

		internal static ConfigEntry<int> MinesPerPlayer;

		internal static ConfigEntry<bool> DisableEnemies;

		internal static ConfigEntry<bool> DisableTraps;

		internal static ConfigEntry<bool> AutoLeaveOnWin;

		internal static ConfigEntry<Key> MenuKey;

		internal static ConfigFile Cfg;

		private void Awake()
		{
			//IL_0221: 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_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Expected O, but got Unknown
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Cfg = ((BaseUnityPlugin)this).Config;
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = false;
			Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Genel", "ModAktif", true, "Mod açık mı (kapalıysa oyun normal oynanır)");
			MenuKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Genel", "MenuTusu", (Key)101, "Menüyü açıp kapatan tuş");
			MoonName = ((BaseUnityPlugin)this).Config.Bind<string>("Mac", "Ay", "Rend", "Maçın oynanacağı ay (iç harita her zaman malikane)");
			DisableEnemies = ((BaseUnityPlugin)this).Config.Bind<bool>("Mac", "CanavarlariKapat", true, "Canavarlar doğmasın");
			DisableTraps = ((BaseUnityPlugin)this).Config.Bind<bool>("Mac", "TuzaklariKapat", true, "Taret / mayın / tuzak doğmasın");
			AutoLeaveOnWin = ((BaseUnityPlugin)this).Config.Bind<bool>("Mac", "KazanincaGemiKalksin", true, "Tek kişi kalınca gemi otomatik kalksın");
			GiveGun = ((BaseUnityPlugin)this).Config.Bind<bool>("Silah", "SilahVer", true, "Herkesin eline otomatik silah verilsin");
			FireRate = ((BaseUnityPlugin)this).Config.Bind<float>("Silah", "AtesHizi", 6f, "Saniyede atış sayısı");
			Damage = ((BaseUnityPlugin)this).Config.Bind<int>("Silah", "Hasar", 20, "Mermi başına hasar (oyuncu canı 100)");
			InfiniteAmmo = ((BaseUnityPlugin)this).Config.Bind<bool>("Silah", "SinirsizMermi", false, "Sınırsız mermi");
			MagazineSize = ((BaseUnityPlugin)this).Config.Bind<int>("Silah", "SarjorBoyutu", 30, "Şarjördeki mermi sayısı");
			ReloadTime = ((BaseUnityPlugin)this).Config.Bind<float>("Silah", "SarjorDegistirmeSuresi", 2.5f, "Şarjör değiştirme süresi (saniye)");
			KeyCount = ((BaseUnityPlugin)this).Config.Bind<int>("Esya", "AnahtarSayisi", 1, "Her oyuncuya verilecek anahtar sayısı (0-2)");
			GiveMineTool = ((BaseUnityPlugin)this).Config.Bind<bool>("Esya", "MayinKoyucuVer", true, "Herkese mayın koyucu (kumanda) verilsin");
			MinesPerPlayer = ((BaseUnityPlugin)this).Config.Bind<int>("Esya", "MayinSayisi", 3, "Oyuncu başına koyulabilecek mayın sayısı");
			((BaseUnityPlugin)this).Config.Save();
			new Harmony("atilla.ManorPvP").PatchAll(typeof(Plugin).Assembly);
			GameObject val = new GameObject("ManorPvP_Manager");
			Object.DontDestroyOnLoad((Object)val);
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<ManorPvPManager>();
			Log.LogInfo((object)"Manor PvP 1.1.0 yüklendi");
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}