Decompiled source of LostCause v0.1.1

LostCause.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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 ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.UI;

[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("LostCause")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1")]
[assembly: AssemblyProduct("LostCause")]
[assembly: AssemblyTitle("LostCause")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.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 LostCause
{
	internal static class GiveUpSequence
	{
		private static readonly List<ItemGun> guns = new List<ItemGun>();

		private static bool searched;

		internal const float TurnSeconds = 2.6f;

		private const byte EventSelfDestruct = 164;

		private static bool eventsRegistered;

		internal static float Start(int seed)
		{
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			FindGuns();
			List<PlayerAvatar> list = new List<PlayerAvatar>();
			foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
			{
				if ((Object)(object)player != (Object)null && !player.deadSet && !player.isDisabled)
				{
					list.Add(player);
				}
			}
			list.Sort((PlayerAvatar a, PlayerAvatar b) => Actor(a).CompareTo(Actor(b)));
			Random random = new Random(seed);
			for (int num = list.Count - 1; num > 0; num--)
			{
				int index = random.Next(num + 1);
				PlayerAvatar value = list[num];
				list[num] = list[index];
				list[index] = value;
			}
			float num2 = Time.time + 1.5f + 2.6f;
			float result = num2;
			foreach (PlayerAvatar item in list)
			{
				ItemGun gun = ((guns.Count > 0) ? guns[random.Next(guns.Count)] : null);
				new GameObject("LostCause Gun").AddComponent<GiveUpGun>().Init(item, gun, num2, random.Next());
				result = num2;
				num2 += 3.6f + (float)random.NextDouble() * 2f;
			}
			return result;
		}

		internal static void EnsureRegistered()
		{
			if (!eventsRegistered && PhotonNetwork.NetworkingClient != null)
			{
				PhotonNetwork.NetworkingClient.EventReceived += OnEvent;
				eventsRegistered = true;
			}
		}

		internal static void SelfDestructLocal()
		{
			//IL_0057: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			PlayerAvatar instance = PlayerAvatar.instance;
			if (!((Object)(object)instance == (Object)null) && !instance.deadSet && !instance.isDisabled)
			{
				int num = Random.Range(1, int.MaxValue);
				if (SemiFunc.IsMultiplayer() && PhotonNetwork.InRoom)
				{
					PhotonNetwork.RaiseEvent((byte)164, (object)new int[2]
					{
						instance.photonView.ViewID,
						num
					}, new RaiseEventOptions
					{
						Receivers = (ReceiverGroup)0
					}, SendOptions.SendReliable);
				}
				StartSingle(instance, num);
			}
		}

		private static void StartSingle(PlayerAvatar player, int seed)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			FindGuns();
			Random random = new Random(seed);
			ItemGun gun = ((guns.Count > 0) ? guns[random.Next(guns.Count)] : null);
			new GameObject("LostCause Gun").AddComponent<GiveUpGun>().Init(player, gun, Time.time + 0.5f + 2.6f, random.Next());
		}

		private static void OnEvent(EventData e)
		{
			if (e.Code == 164 && e.CustomData is int[] array && array.Length == 2)
			{
				PhotonView val = PhotonView.Find(array[0]);
				PlayerAvatar val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<PlayerAvatar>() : null);
				if ((Object)(object)val2 != (Object)null && !val2.deadSet)
				{
					StartSingle(val2, array[1]);
				}
			}
		}

		private static int Actor(PlayerAvatar player)
		{
			Player owner = player.photonView.Owner;
			if (owner == null)
			{
				return 0;
			}
			return owner.ActorNumber;
		}

		private static void FindGuns()
		{
			if (searched || (Object)(object)StatsManager.instance == (Object)null)
			{
				return;
			}
			searched = true;
			foreach (Item value in StatsManager.instance.itemDictionary.Values)
			{
				if ((Object)(object)value == (Object)null || value.prefab == null || !((PrefabRef<GameObject>)(object)value.prefab).IsValid())
				{
					continue;
				}
				string text = value.itemName ?? "";
				if (text.IndexOf("shotgun", StringComparison.OrdinalIgnoreCase) >= 0)
				{
					GameObject prefab = ((PrefabRef<GameObject>)(object)value.prefab).Prefab;
					ItemGun val = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<ItemGun>() : null);
					if ((Object)(object)val != (Object)null && (Object)(object)val.gunMuzzle != (Object)null)
					{
						guns.Add(val);
						Plugin.Log.LogInfo((object)("Vapen för slutscenen: " + text));
					}
				}
			}
			if (guns.Count == 0)
			{
				Plugin.Log.LogWarning((object)"Hittade inga vapen för slutscenen; spelarna dör utan vapen.");
			}
		}
	}
	internal sealed class HeadLauncher : MonoBehaviour
	{
		private const float Timeout = 5f;

		private PlayerAvatar player;

		private Vector3 direction;

		private float started;

		private bool sawTrigger;

		internal void Init(PlayerAvatar target, Vector3 away)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			player = target;
			direction = away;
			started = Time.time;
		}

		private void Update()
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: 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)
			PlayerDeathHead val = (((Object)(object)player != (Object)null) ? player.playerDeathHead : null);
			if ((Object)(object)val == (Object)null || Time.time - started > 5f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			else
			{
				if (!val.triggered)
				{
					return;
				}
				if (val.triggeredTimer > 0f)
				{
					sawTrigger = true;
				}
				else if (sawTrigger || !(Time.time - started < 1.5f))
				{
					Rigidbody val2 = (((Object)(object)val.physGrabObject != (Object)null) ? val.physGrabObject.rb : null);
					if ((Object)(object)val2 != (Object)null)
					{
						Vector3 val3 = Random.insideUnitSphere * 0.25f;
						Vector3 val4 = direction + val3;
						val2.AddForce(((Vector3)(ref val4)).normalized * Plugin.HeadLaunchSpeed.Value, (ForceMode)2);
						val2.AddTorque(Random.onUnitSphere * 30f, (ForceMode)2);
						Plugin.Log.LogInfo((object)("Huvudet skjuts iväg (" + player.playerName + ")."));
					}
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}
		}
	}
	internal sealed class GiveUpGun : MonoBehaviour
	{
		private const float RaiseSeconds = 0.7f;

		private const float AfterShotSeconds = 1.2f;

		private const float SpeakBeforeShot = 2f;

		private PlayerAvatar player;

		private ItemGun gunPrefab;

		private float shootAt;

		private float started;

		private bool shot;

		private bool spoke;

		private Transform model;

		private Vector3 muzzleLocalPosition;

		private Quaternion muzzleLocalRotation;

		private Quaternion barrelLocalRotation = Quaternion.identity;

		private bool loggedPlacement;

		private Transform leftArm;

		private Transform rightArm;

		private Transform headPitch;

		private Renderer leftArmMesh;

		private Renderer rightArmMesh;

		private Transform leftArmSpring;

		private Transform rightArmSpring;

		private Vector3 leftGrip;

		private Vector3 rightGrip;

		private float headTilt;

		private bool posed;

		private bool IsLocal => (Object)(object)player == (Object)(object)PlayerAvatar.instance;

		private bool FirstPerson
		{
			get
			{
				if (IsLocal)
				{
					return !Plugin.ThirdPerson.Value;
				}
				return false;
			}
		}

		internal void Init(PlayerAvatar target, ItemGun gun, float shotTime, int seed)
		{
			player = target;
			gunPrefab = gun;
			shootAt = shotTime;
			started = shotTime - 2.6f;
			if ((Object)(object)gunPrefab != (Object)null)
			{
				BuildModel();
				((Component)model).gameObject.SetActive(false);
			}
		}

		private void BuildModel()
		{
			//IL_0012: 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_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: 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_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: 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_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: 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_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)gunPrefab).transform;
			model = new GameObject("Model").transform;
			model.SetParent(((Component)this).transform, false);
			List<string> list = new List<string>();
			List<string> list2 = new List<string>();
			Renderer[] componentsInChildren = ((Component)transform).GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val in componentsInChildren)
			{
				Mesh val2 = null;
				if (val is MeshRenderer)
				{
					MeshFilter component = ((Component)val).GetComponent<MeshFilter>();
					val2 = ((component != null) ? component.sharedMesh : null);
				}
				else
				{
					SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)(object)((val is SkinnedMeshRenderer) ? val : null);
					if (val3 != null)
					{
						val2 = val3.sharedMesh;
					}
				}
				if ((Object)(object)val2 == (Object)null || !val.enabled || !ActiveInPrefab(((Component)val).transform, transform))
				{
					list2.Add(((Object)val).name);
					continue;
				}
				list.Add(((Object)val).name);
				GameObject val4 = new GameObject(((Object)val).name);
				val4.transform.SetParent(model, false);
				val4.transform.localPosition = transform.InverseTransformPoint(((Component)val).transform.position);
				val4.transform.localRotation = Quaternion.Inverse(transform.rotation) * ((Component)val).transform.rotation;
				val4.transform.localScale = Divide(((Component)val).transform.lossyScale, transform.lossyScale);
				val4.AddComponent<MeshFilter>().sharedMesh = val2;
				MeshRenderer obj = val4.AddComponent<MeshRenderer>();
				((Renderer)obj).sharedMaterials = val.sharedMaterials;
				((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
			}
			Plugin.Log.LogInfo((object)("Vapenmodell " + ((Object)transform).name + ": kopierade [" + string.Join(", ", list) + "], hoppade över [" + string.Join(", ", list2) + "]."));
			float value = Plugin.GunLength.Value;
			Vector3 center;
			float num = LongestSide(model, out center);
			model.localScale = Vector3.one * ((num > 0.001f) ? (value / num) : 1f);
			Plugin.Log.LogInfo((object)$"Vapenmodell {((Object)transform).name}: originalstorlek {num:0.00}, skalad till {value} m.");
			muzzleLocalPosition = transform.InverseTransformPoint(gunPrefab.gunMuzzle.position);
			muzzleLocalRotation = Quaternion.Inverse(transform.rotation) * gunPrefab.gunMuzzle.rotation;
			Vector3 val5 = muzzleLocalPosition - center;
			barrelLocalRotation = ((((Vector3)(ref val5)).sqrMagnitude > 0.0001f) ? Quaternion.LookRotation(((Vector3)(ref val5)).normalized, (Mathf.Abs(Vector3.Dot(((Vector3)(ref val5)).normalized, Vector3.up)) > 0.9f) ? Vector3.forward : Vector3.up) : muzzleLocalRotation);
		}

		private void LateUpdate()
		{
			if ((Object)(object)player == (Object)null)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			if (IsLocal && !shot)
			{
				PlayerController.instance.InputDisable(0.1f);
			}
			if (IsLocal && Plugin.ThirdPerson.Value && !player.deadSet && Time.time < shootAt + 0.6f)
			{
				ThirdPersonCamera();
			}
			if (!(Time.time < started))
			{
				if ((Object)(object)player.flashlightController != (Object)null)
				{
					player.flashlightController.hideFlashlight = true;
				}
				if ((Object)(object)model != (Object)null && !((Component)model).gameObject.activeSelf)
				{
					((Component)model).gameObject.SetActive(true);
				}
				if (IsLocal && !spoke && Time.time >= shootAt - 2f)
				{
					spoke = true;
					player.ChatMessageSend("Goodbye World", "en-US");
				}
				Place();
				if (!shot && Time.time >= shootAt)
				{
					Shoot();
				}
				if (shot && Time.time >= shootAt + 1.2f)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}
		}

		private void Place()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_0165: 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_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: 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_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: 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_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: 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)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: 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_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: 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_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: 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_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: 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_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_0436: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0451: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val;
			Vector3 val2;
			Vector3 val3;
			Vector3 val4;
			if (FirstPerson && (Object)(object)Camera.main != (Object)null)
			{
				Transform transform = ((Component)Camera.main).transform;
				val = transform.position;
				val2 = transform.right;
				val3 = Vector3.ProjectOnPlane(transform.forward, Vector3.up);
				val4 = ((Vector3)(ref val3)).normalized;
			}
			else
			{
				Transform val5 = (((Object)(object)player.PlayerVisionTarget != (Object)null) ? player.PlayerVisionTarget.VisionTransform : null);
				val = (((Object)(object)val5 != (Object)null) ? val5.position : (((Component)player).transform.position + Vector3.up * 1.4f));
				val4 = BodyForward();
				val2 = Vector3.Cross(Vector3.up, val4);
			}
			float num = Mathf.Clamp01((Time.time - started) / 0.7f);
			num = 1f - (1f - num) * (1f - num);
			float num2 = Mathf.Clamp01(1f - (shootAt - Time.time) / 2.6f);
			Vector3 val6 = (shot ? Vector3.zero : (new Vector3(Mathf.PerlinNoise(Time.time * 9f, 0.3f) - 0.5f, Mathf.PerlinNoise(0.7f, Time.time * 9f) - 0.5f, 0f) * (0.006f + 0.015f * num2)));
			float value = Plugin.GunLength.Value;
			Transform val7 = (((Object)(object)player.playerAvatarVisuals != (Object)null) ? player.playerAvatarVisuals.attachPointJawBottom : null);
			Vector3 val8 = (((Object)(object)val7 != (Object)null && !FirstPerson) ? (val7.position + val4 * Plugin.GunForward.Value - Vector3.up * 0.06f) : (val - Vector3.up * 0.2f + val4 * (Plugin.GunForward.Value + 0.05f)));
			val3 = Vector3.up * 0.8f - val4 * 0.6f;
			Vector3 normalized = ((Vector3)(ref val3)).normalized;
			Vector3 val9 = val8;
			Vector3 val10 = val4;
			Vector3 val11 = val - Vector3.up * 0.5f + val4 * (0.15f + value);
			val3 = Vector3.Slerp(val10, normalized, num);
			Vector3 normalized2 = ((Vector3)(ref val3)).normalized;
			Vector3 val12 = Vector3.Lerp(val11, val9, num) + val2 * val6.x + Vector3.up * val6.y;
			float num3 = (shot ? Mathf.Clamp01((Time.time - shootAt) / 0.15f) : 0f);
			Vector3 val13 = normalized2;
			val3 = normalized2 + val4 * 1.5f;
			normalized2 = Vector3.Slerp(val13, ((Vector3)(ref val3)).normalized, num3 * 0.5f);
			val12 += (val4 * 0.12f + Vector3.up * 0.04f) * num3;
			leftGrip = val12 - normalized2 * (value * 0.35f);
			rightGrip = val12 - normalized2 * (value * 0.7f);
			headTilt = (shot ? headTilt : (Mathf.Clamp01((Time.time - (shootAt - 1f)) / 0.6f) * 40f));
			posed = !shot || Time.time < shootAt + 0.3f;
			if ((Object)(object)model == (Object)null)
			{
				((Component)this).transform.position = val12;
				return;
			}
			Quaternion val14 = Quaternion.LookRotation(normalized2, -val4) * Quaternion.Inverse(barrelLocalRotation);
			((Component)this).transform.rotation = val14;
			((Component)this).transform.position = val12 - val14 * Vector3.Scale(muzzleLocalPosition, model.localScale);
			if (num >= 1f)
			{
				LogPlacement(val, val8, val4);
			}
		}

		private Vector3 BodyForward()
		{
			//IL_0030: 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_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_0056: 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)
			Vector3 val = Vector3.ProjectOnPlane((((Object)(object)player.playerAvatarVisuals != (Object)null) ? ((Component)player.playerAvatarVisuals).transform : ((Component)player).transform).forward, Vector3.up);
			if (!(((Vector3)(ref val)).sqrMagnitude > 0.0001f))
			{
				return Vector3.forward;
			}
			return ((Vector3)(ref val)).normalized;
		}

		private void LogPlacement(Vector3 head, Vector3 chin, Vector3 forward)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_00be: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			if (!loggedPlacement && !((Object)(object)model == (Object)null))
			{
				loggedPlacement = true;
				Bounds val = default(Bounds);
				((Bounds)(ref val))..ctor(((Component)this).transform.position, Vector3.zero);
				Renderer[] componentsInChildren = ((Component)model).GetComponentsInChildren<Renderer>();
				foreach (Renderer val2 in componentsInChildren)
				{
					((Bounds)(ref val)).Encapsulate(val2.bounds);
				}
				Transform val3 = (((Object)(object)player.playerAvatarVisuals != (Object)null) ? ((Component)player.playerAvatarVisuals).transform : null);
				Plugin.Log.LogInfo((object)($"Placering {player.playerName}: spelare {((Component)player).transform.position} fram {((Component)player).transform.forward}, " + string.Format("visuell fram {0}, huvud {1}, käke {2}, ", ((Object)(object)val3 != (Object)null) ? ((object)val3.forward/*cast due to .constrained prefix*/).ToString() : "-", head, chin) + $"använd fram {forward}, vapnets mitt {((Bounds)(ref val)).center} storlek {((Bounds)(ref val)).size}, skala {model.localScale.x:0.000}, " + $"tredjeperson {Plugin.ThirdPerson.Value}, lokal {IsLocal}."));
			}
		}

		private void OnEnable()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			Application.onBeforeRender += new UnityAction(ApplyPose);
		}

		private void OnDisable()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			Application.onBeforeRender -= new UnityAction(ApplyPose);
		}

		private void OnDestroy()
		{
			if ((Object)(object)player != (Object)null && (Object)(object)player.flashlightController != (Object)null)
			{
				player.flashlightController.hideFlashlight = false;
			}
		}

		private void FindPoseTransforms()
		{
			PlayerAvatarVisuals playerAvatarVisuals = player.playerAvatarVisuals;
			if ((Object)(object)playerAvatarVisuals == (Object)null)
			{
				return;
			}
			Transform[] componentsInChildren = ((Component)playerAvatarVisuals).GetComponentsInChildren<Transform>(true);
			foreach (Transform val in componentsInChildren)
			{
				if (((Object)val).name == "ANIM ARM L")
				{
					leftArm = val;
				}
				else if (((Object)val).name == "ANIM ARM R" && (Object)(object)rightArm == (Object)null)
				{
					rightArm = val;
				}
			}
			if ((Object)(object)playerAvatarVisuals.playerAvatarRightArm != (Object)null && (Object)(object)playerAvatarVisuals.playerAvatarRightArm.rightArmTransform != (Object)null)
			{
				rightArm = playerAvatarVisuals.playerAvatarRightArm.rightArmTransform;
			}
			headPitch = playerAvatarVisuals.headUpTransform;
			leftArmMesh = ArmMesh(leftArm, "mesh_arm_l");
			rightArmMesh = ArmMesh(rightArm, "mesh_arm_r");
			leftArmSpring = SpringPart(leftArmMesh, leftArm);
			rightArmSpring = SpringPart(rightArmMesh, rightArm);
			ManualLogSource log = Plugin.Log;
			string[] obj = new string[15]
			{
				"Armar ", player.playerName, ": vänster ", null, null, null, null, null, null, null,
				null, null, null, null, null
			};
			Transform obj2 = leftArm;
			obj[3] = ((obj2 != null) ? ((Object)obj2).name : null);
			obj[4] = "/";
			Transform obj3 = leftArmSpring;
			obj[5] = ((obj3 != null) ? ((Object)obj3).name : null);
			obj[6] = "/";
			Renderer obj4 = leftArmMesh;
			obj[7] = ((obj4 != null) ? ((Object)obj4).name : null);
			obj[8] = ", höger ";
			Transform obj5 = rightArm;
			obj[9] = ((obj5 != null) ? ((Object)obj5).name : null);
			obj[10] = "/";
			Transform obj6 = rightArmSpring;
			obj[11] = ((obj6 != null) ? ((Object)obj6).name : null);
			obj[12] = "/";
			Renderer obj7 = rightArmMesh;
			obj[13] = ((obj7 != null) ? ((Object)obj7).name : null);
			obj[14] = ".";
			log.LogInfo((object)string.Concat(obj));
		}

		private static Transform SpringPart(Renderer mesh, Transform armRoot)
		{
			if ((Object)(object)mesh == (Object)null)
			{
				return armRoot;
			}
			Transform val = ((Component)mesh).transform;
			while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)armRoot)
			{
				if (((Object)val).name.StartsWith("Player Spring Impulse"))
				{
					return val;
				}
				val = val.parent;
			}
			return armRoot;
		}

		private void ApplyPose()
		{
			//IL_0094: 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_00dd: 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)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)player == (Object)null) && posed && !(Time.time < started) && !player.deadSet && !((Object)(object)model == (Object)null) && ((Component)model).gameObject.activeSelf)
			{
				if ((Object)(object)headPitch == (Object)null && (Object)(object)leftArm == (Object)null && (Object)(object)rightArm == (Object)null)
				{
					FindPoseTransforms();
				}
				PointArm(leftArm, leftArmSpring, leftArmMesh, leftGrip);
				PointArm(rightArm, rightArmSpring, rightArmMesh, rightGrip);
				if ((Object)(object)headPitch != (Object)null && headTilt > 0f)
				{
					Transform obj = headPitch;
					obj.localRotation *= Quaternion.Euler(headTilt, 0f, 0f);
				}
			}
		}

		private static void PointArm(Transform shoulder, Transform part, Renderer mesh, Vector3 grip)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_0074: 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)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008d: 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)
			if (!((Object)(object)shoulder == (Object)null) && !((Object)(object)part == (Object)null) && !((Object)(object)mesh == (Object)null))
			{
				Vector3 position = shoulder.position;
				Bounds bounds = mesh.bounds;
				Vector3 val = ((Bounds)(ref bounds)).center - position;
				Vector3 val2 = grip - position;
				if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f) && !(((Vector3)(ref val2)).sqrMagnitude < 0.0001f))
				{
					Quaternion val3 = Quaternion.FromToRotation(((Vector3)(ref val)).normalized, ((Vector3)(ref val2)).normalized);
					part.SetPositionAndRotation(position + val3 * (part.position - position), val3 * part.rotation);
				}
			}
		}

		private static Renderer ArmMesh(Transform arm, string prefix)
		{
			if ((Object)(object)arm == (Object)null)
			{
				return null;
			}
			Renderer[] componentsInChildren = ((Component)arm).GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val in componentsInChildren)
			{
				if (((Object)val).name.StartsWith(prefix))
				{
					return val;
				}
			}
			return null;
		}

		private void ThirdPersonCamera()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_0080: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			Transform val = (((Object)(object)player.PlayerVisionTarget != (Object)null) ? player.PlayerVisionTarget.VisionTransform : null);
			Vector3 val2 = (((Object)(object)val != (Object)null) ? val.position : (((Component)player).transform.position + Vector3.up * 1.4f));
			Transform transform = ((Component)player).transform;
			Vector3 val3 = val2 + transform.forward * 1.9f + transform.right * 0.8f + Vector3.up * 0.25f;
			Vector3 val4 = val3 - val2;
			RaycastHit val5 = default(RaycastHit);
			if (Physics.SphereCast(val2, 0.2f, ((Vector3)(ref val4)).normalized, ref val5, ((Vector3)(ref val4)).magnitude, LayerMask.GetMask(new string[1] { "Default" }), (QueryTriggerInteraction)1))
			{
				val3 = val2 + ((Vector3)(ref val4)).normalized * Mathf.Max(0.4f, ((RaycastHit)(ref val5)).distance - 0.1f);
			}
			player.playerAvatarVisuals.ShowSelfOverride(0.2f);
			CameraPosition instance = CameraPosition.instance;
			if (instance != null)
			{
				instance.OverridePosition(val3, 0.2f);
			}
			CameraAim instance2 = CameraAim.Instance;
			if (instance2 != null)
			{
				instance2.AimTargetSet(val2, 0.2f, 20f, ((Component)player).gameObject, 90);
			}
			PlayerController.instance.OverrideDisableTurn(0.2f, false);
		}

		private void Shoot()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0049: 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_0053: 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_0058: 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_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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: 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_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			shot = true;
			Vector3 val = (((Object)(object)model != (Object)null) ? (((Component)this).transform.position + ((Component)this).transform.rotation * Vector3.Scale(muzzleLocalPosition, model.localScale)) : ((Component)this).transform.position);
			Quaternion val2 = ((Component)this).transform.rotation * muzzleLocalRotation;
			if ((Object)(object)gunPrefab != (Object)null)
			{
				if ((Object)(object)gunPrefab.muzzleFlashPrefab != (Object)null)
				{
					ItemGunMuzzleFlash component = Object.Instantiate<GameObject>(gunPrefab.muzzleFlashPrefab, val, val2, ((Component)this).transform).GetComponent<ItemGunMuzzleFlash>();
					if (component != null)
					{
						component.ActivateAllEffects();
					}
				}
				Sound soundShoot = gunPrefab.soundShoot;
				if (soundShoot != null)
				{
					soundShoot.Play(val, 1f, 1f, 1f, 1f);
				}
				Sound soundShootGlobal = gunPrefab.soundShootGlobal;
				if (soundShootGlobal != null)
				{
					soundShootGlobal.Play(val, 1f, 1f, 1f, 1f);
				}
			}
			SemiFunc.CameraShakeImpactDistance(val, 6f, 0.15f, 3f, 16f);
			SemiFunc.CameraShakeDistance(val, 0.3f, 0.2f, 3f, 16f);
			if (IsLocal && !player.deadSet && !player.isDisabled)
			{
				Plugin.Log.LogInfo((object)"Besättningen gav upp.");
				player.PlayerDeath(-1);
			}
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				Vector3 val3 = BodyForward();
				Vector3 val4 = Vector3.up * 1f - val3 * 0.55f;
				Vector3 normalized = ((Vector3)(ref val4)).normalized;
				new GameObject("LostCause Head Launch").AddComponent<HeadLauncher>().Init(player, normalized);
			}
		}

		private static bool ActiveInPrefab(Transform t, Transform root)
		{
			Transform val = t;
			while ((Object)(object)val != (Object)null)
			{
				if (!((Component)val).gameObject.activeSelf)
				{
					return false;
				}
				if ((Object)(object)val == (Object)(object)root)
				{
					break;
				}
				val = val.parent;
			}
			return true;
		}

		private static float LongestSide(Transform model, out Vector3 center)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_0097: 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_00b3: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			Bounds val = default(Bounds);
			bool flag = false;
			MeshFilter[] componentsInChildren = ((Component)model).GetComponentsInChildren<MeshFilter>(true);
			foreach (MeshFilter val2 in componentsInChildren)
			{
				Bounds bounds = val2.sharedMesh.bounds;
				Matrix4x4 val3 = Matrix4x4.TRS(((Component)val2).transform.localPosition, ((Component)val2).transform.localRotation, ((Component)val2).transform.localScale);
				for (int j = 0; j < 8; j++)
				{
					Vector3 val4 = ((Matrix4x4)(ref val3)).MultiplyPoint3x4(((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((j & 1) != 0) ? 1 : (-1)), (float)(((j & 2) != 0) ? 1 : (-1)), (float)(((j & 4) != 0) ? 1 : (-1)))));
					if (flag)
					{
						((Bounds)(ref val)).Encapsulate(val4);
						continue;
					}
					((Bounds)(ref val))..ctor(val4, Vector3.zero);
					flag = true;
				}
			}
			center = ((Bounds)(ref val)).center;
			if (!flag)
			{
				return 0f;
			}
			return Mathf.Max(new float[3]
			{
				((Bounds)(ref val)).size.x,
				((Bounds)(ref val)).size.y,
				((Bounds)(ref val)).size.z
			});
		}

		private static Vector3 Divide(Vector3 a, Vector3 b)
		{
			//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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(a.x / b.x, a.y / b.y, a.z / b.z);
		}
	}
	internal sealed class LostCauseController : MonoBehaviour
	{
		private enum State
		{
			Idle,
			Voting,
			GivingUp
		}

		private const byte EventVoteStart = 160;

		private const byte EventVote = 161;

		private const byte EventTally = 162;

		private const byte EventResult = 163;

		private const float CheckInterval = 2f;

		private const float DeathDelay = 3f;

		private const float ResultShowSeconds = 4f;

		private static LostCauseController instance;

		private static bool eventsRegistered;

		private State state;

		private float levelStart;

		private float voteEnd;

		private int available;

		private int required;

		private int yes;

		private int no;

		private int total;

		private bool? myVote;

		private float resultUntil;

		private bool resultPassed;

		private float deathAt = -1f;

		private float nextCheck;

		private float cooldownUntil;

		private bool testVoteDone;

		private readonly Dictionary<int, bool> votes = new Dictionary<int, bool>();

		private VoteUI ui;

		private void Awake()
		{
			instance = this;
			levelStart = Time.time;
			if (!eventsRegistered && PhotonNetwork.NetworkingClient != null)
			{
				PhotonNetwork.NetworkingClient.EventReceived += OnEvent;
				eventsRegistered = true;
			}
			ui = new VoteUI();
		}

		private void OnDestroy()
		{
			ui.Destroy();
			if ((Object)(object)instance == (Object)(object)this)
			{
				instance = null;
			}
		}

		private void Update()
		{
			if (SemiFunc.RunIsLevel())
			{
				if (SemiFunc.IsMasterClientOrSingleplayer())
				{
					HostUpdate();
				}
				if (state == State.Voting)
				{
					ReadLocalVote();
				}
				if (deathAt > 0f && Time.time >= deathAt)
				{
					deathAt = -1f;
					KillLocalPlayer();
				}
				Draw();
			}
		}

		private void HostUpdate()
		{
			if (state == State.Idle && Time.time >= nextCheck)
			{
				nextCheck = Time.time + 2f;
				CheckQuota();
			}
			else if (state == State.Voting)
			{
				total = Mathf.Max(1, GameDirector.instance.PlayerList.Count);
				int num = total / 2 + 1;
				if (yes >= num)
				{
					FinishVote(passed: true);
				}
				else if (no > total - num || yes + no >= total || Time.time >= voteEnd)
				{
					FinishVote(yes >= num);
				}
			}
		}

		private void CheckQuota()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Invalid comparison between Unknown and I4
			RoundDirector val = RoundDirector.instance;
			if (!((Object)(object)val == (Object)null) && !(Time.time < cooldownUntil) && !(Time.time - levelStart < Plugin.GraceSeconds.Value) && !((Object)(object)LevelGenerator.Instance == (Object)null) && LevelGenerator.Instance.Generated && (int)GameDirector.instance.currentState == 2 && val.extractionPointsFetched && val.extractionPoints > 0 && !val.allExtractionPointsCompleted && QuotaMath.ValuesReady())
			{
				int num = QuotaMath.Available();
				int num2 = QuotaMath.Required(val);
				bool flag = Plugin.TestForceVote.Value && !testVoteDone;
				if (num < num2 || flag)
				{
					testVoteDone = true;
					Plugin.Log.LogInfo((object)$"Kvoten går inte att nå: {num} kvar på kartan, {num2} krävs. Omröstning startar.");
					votes.Clear();
					Send(160, new int[2] { num, num2 });
					OnVoteStart(num, num2);
				}
			}
		}

		private void HostReceiveVote(int actor, bool vote)
		{
			if (state != State.Voting)
			{
				return;
			}
			votes[actor] = vote;
			yes = (no = 0);
			foreach (bool value in votes.Values)
			{
				if (value)
				{
					yes++;
				}
				else
				{
					no++;
				}
			}
			total = Mathf.Max(1, GameDirector.instance.PlayerList.Count);
			Send(162, new int[3] { yes, no, total });
		}

		private void FinishVote(bool passed)
		{
			Plugin.Log.LogInfo((object)string.Format("Omröstningen {0}: {1} ja, {2} nej av {3}.", passed ? "gick igenom" : "föll", yes, no, total));
			if (!passed)
			{
				cooldownUntil = Time.time + Plugin.CooldownSeconds.Value;
			}
			int num = Random.Range(1, int.MaxValue);
			Send(163, new object[2] { passed, num });
			OnResult(passed, num);
		}

		private void ReadLocalVote()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected O, but got Unknown
			Keyboard current = Keyboard.current;
			if (current == null || myVote.HasValue || ((Object)(object)ChatManager.instance != (Object)null && ChatManager.instance.chatActive))
			{
				return;
			}
			bool? flag = null;
			if (((ButtonControl)current[Plugin.YesKey.Value]).wasPressedThisFrame)
			{
				flag = true;
			}
			else if (((ButtonControl)current[Plugin.NoKey.Value]).wasPressedThisFrame)
			{
				flag = false;
			}
			if (flag.HasValue)
			{
				myVote = flag;
				if (SemiFunc.IsMasterClientOrSingleplayer())
				{
					Player localPlayer = PhotonNetwork.LocalPlayer;
					HostReceiveVote((localPlayer != null) ? localPlayer.ActorNumber : 0, flag.Value);
				}
				else
				{
					PhotonNetwork.RaiseEvent((byte)161, (object)flag.Value, new RaiseEventOptions
					{
						Receivers = (ReceiverGroup)2
					}, SendOptions.SendReliable);
				}
			}
		}

		private void OnVoteStart(int left, int need)
		{
			state = State.Voting;
			available = left;
			required = need;
			yes = (no = 0);
			total = Mathf.Max(1, GameDirector.instance.PlayerList.Count);
			myVote = null;
			voteEnd = Time.time + Plugin.VoteSeconds.Value;
		}

		private void OnResult(bool passed, int seed)
		{
			state = (passed ? State.GivingUp : State.Idle);
			resultPassed = passed;
			resultUntil = Time.time + 4f;
			if (passed)
			{
				float num = GiveUpSequence.Start(seed);
				deathAt = num + 3f;
				resultUntil = Mathf.Max(resultUntil, num + 1f);
			}
		}

		private static void KillLocalPlayer()
		{
			PlayerAvatar val = PlayerAvatar.instance;
			if ((Object)(object)val != (Object)null && !val.deadSet && !val.isDisabled)
			{
				Plugin.Log.LogInfo((object)"Besättningen gav upp (reserv).");
				val.PlayerDeath(-1);
			}
		}

		private void Draw()
		{
			if (state == State.Voting)
			{
				ui.ShowVote(available, required, yes, no, total, myVote, Mathf.Max(0f, voteEnd - Time.time));
			}
			else if (Time.time < resultUntil)
			{
				ui.ShowResult(resultPassed, yes, no, total);
			}
			else
			{
				ui.Hide();
			}
		}

		private static void Send(byte code, object content)
		{
			//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_0018: 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_0027: Expected O, but got Unknown
			if (SemiFunc.IsMultiplayer() && PhotonNetwork.InRoom)
			{
				PhotonNetwork.RaiseEvent(code, content, new RaiseEventOptions
				{
					Receivers = (ReceiverGroup)0
				}, SendOptions.SendReliable);
			}
		}

		private static void OnEvent(EventData e)
		{
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			switch (e.Code)
			{
			case 160:
				if (e.CustomData is int[] array2 && array2.Length == 2)
				{
					instance.OnVoteStart(array2[0], array2[1]);
				}
				break;
			case 161:
				if (e.CustomData is bool vote && SemiFunc.IsMasterClient())
				{
					instance.HostReceiveVote(e.Sender, vote);
				}
				break;
			case 162:
				if (e.CustomData is int[] array3 && array3.Length == 3)
				{
					instance.yes = array3[0];
					instance.no = array3[1];
					instance.total = array3[2];
				}
				break;
			case 163:
				if (e.CustomData is object[] array && array.Length == 2 && array[0] is bool passed && array[1] is int seed)
				{
					instance.OnResult(passed, seed);
				}
				break;
			}
		}
	}
	[BepInPlugin("kinglir.lostcause", "LostCause", "0.1.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string Guid = "kinglir.lostcause";

		public const string Name = "LostCause";

		public const string Version = "0.1.1";

		internal static ManualLogSource Log;

		internal static ConfigEntry<float> VoteSeconds;

		internal static ConfigEntry<float> CooldownSeconds;

		internal static ConfigEntry<float> GraceSeconds;

		internal static ConfigEntry<Key> YesKey;

		internal static ConfigEntry<Key> NoKey;

		internal static ConfigEntry<bool> TestForceVote;

		internal static ConfigEntry<bool> ReplaceSelfDestruct;

		internal static ConfigEntry<bool> ThirdPerson;

		internal static ConfigEntry<float> GunLength;

		internal static ConfigEntry<float> GunForward;

		internal static ConfigEntry<float> HeadLaunchSpeed;

		private void Awake()
		{
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			VoteSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Vote", "VoteSeconds", 30f, "Hur länge omröstningen pågår.");
			CooldownSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Vote", "CooldownSeconds", 180f, "Tid innan en ny omröstning kan starta efter att spelarna röstat nej.");
			GraceSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Vote", "GraceSeconds", 30f, "Tid efter nivåstart innan kartans värde börjar kontrolleras (värdesakernas värden sätts strax efter start).");
			YesKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Vote", "YesKey", (Key)39, "Tangent för att rösta ja.");
			NoKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Vote", "NoKey", (Key)28, "Tangent för att rösta nej.");
			ReplaceSelfDestruct = ((BaseUnityPlugin)this).Config.Bind<bool>("Scene", "ReplaceSelfDestruct", true, "Self Destruct i ESC-menyn spelar upp vapenscenen (\"Goodbye World\" och skott) i stället för spelets vanliga.");
			ThirdPerson = ((BaseUnityPlugin)this).Config.Bind<bool>("Scene", "ThirdPerson", true, "Kameran går ut i tredjeperson och visar dig själv under vapenscenen.");
			GunLength = ((BaseUnityPlugin)this).Config.Bind<float>("Scene", "GunLength", 0.45f, "Hagelgevärets längd i meter i vapenscenen.");
			GunForward = ((BaseUnityPlugin)this).Config.Bind<float>("Scene", "GunForward", 0.32f, "Hur långt framför käken (meter) mynningen hålls. Öka om vapnet hamnar inne i kroppen.");
			HeadLaunchSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Scene", "HeadLaunchSpeed", 16f, "Hur hårt huvudet skjuts iväg efter skottet (m/s). 0 = spelets vanliga lilla knuff.");
			TestForceVote = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "TestForceVote", false, "Endast för test: en omröstning startar på varje nivå efter GraceSeconds, även om kvoten går att nå.");
			new Harmony("kinglir.lostcause").PatchAll();
			Log.LogInfo((object)"LostCause 0.1.1 laddad.");
		}
	}
	[HarmonyPatch(typeof(RoundDirector), "Start")]
	internal static class RoundDirectorStartPatch
	{
		private static void Postfix(RoundDirector __instance)
		{
			GiveUpSequence.EnsureRegistered();
			if ((Object)(object)((Component)__instance).GetComponent<LostCauseController>() == (Object)null)
			{
				((Component)__instance).gameObject.AddComponent<LostCauseController>();
			}
		}
	}
	[HarmonyPatch(typeof(PlayerAvatar), "Start")]
	internal static class PlayerAvatarStartPatch
	{
		private static void Postfix()
		{
			GiveUpSequence.EnsureRegistered();
		}
	}
	[HarmonyPatch(typeof(MenuPageEsc), "ButtonEventSelfDestruct")]
	internal static class SelfDestructPatch
	{
		private static bool Prefix()
		{
			if (!Plugin.ReplaceSelfDestruct.Value)
			{
				return true;
			}
			GiveUpSequence.EnsureRegistered();
			GiveUpSequence.SelfDestructLocal();
			MenuManager.instance.PageCloseAll();
			return false;
		}
	}
	internal static class QuotaMath
	{
		internal static int Required(RoundDirector round)
		{
			int num = Mathf.Max(1, round.extractionPoints);
			int num2 = round.haulGoal / num;
			int num3 = Mathf.Max(0, round.extractionPoints - round.extractionPointsCompleted);
			return Mathf.Max(0, num2 * num3 - round.extractionPointSurplus);
		}

		internal static int Available()
		{
			float num = 0f;
			ValuableObject[] array = Object.FindObjectsByType<ValuableObject>((FindObjectsSortMode)0);
			foreach (ValuableObject val in array)
			{
				if ((Object)(object)val != (Object)null)
				{
					num += val.dollarValueCurrent;
				}
			}
			ItemValuableBox[] array2 = Object.FindObjectsByType<ItemValuableBox>((FindObjectsSortMode)0);
			foreach (ItemValuableBox val2 in array2)
			{
				if ((Object)(object)val2 != (Object)null)
				{
					num += val2.CurrentValue;
				}
			}
			return Mathf.FloorToInt(num);
		}

		internal static bool ValuesReady()
		{
			ValuableObject[] array = Object.FindObjectsByType<ValuableObject>((FindObjectsSortMode)0);
			foreach (ValuableObject val in array)
			{
				if ((Object)(object)val != (Object)null && !val.dollarValueSet)
				{
					return false;
				}
			}
			return true;
		}

		internal static string Dollars(int value)
		{
			return "$" + SemiFunc.DollarGetString(value);
		}
	}
	internal sealed class VoteUI
	{
		private GameObject canvasObject;

		private TextMeshProUGUI text;

		internal void ShowVote(int available, int required, int yes, int no, int total, bool? myVote, float secondsLeft)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			string text = ((object)Plugin.YesKey.Value/*cast due to .constrained prefix*/).ToString().ToUpperInvariant();
			string text2 = ((object)Plugin.NoKey.Value/*cast due to .constrained prefix*/).ToString().ToUpperInvariant();
			string text3 = (myVote.HasValue ? ("\n<size=70%><color=#AAAAAA>You voted " + (myVote.Value ? "<color=#FF4444>YES</color>" : "<color=#88FF88>NO</color>") + "</color></size>") : "");
			Show("<color=#FF3333><b>THE QUOTA IS LOST</b></color>\n<size=70%>" + QuotaMath.Dollars(available) + " left on the map - " + QuotaMath.Dollars(required) + " needed</size>\nGive up and die together?\n" + $"<b>[{text}]</b> Yes  <color=#FF4444>{yes}</color>     <b>[{text2}]</b> No  <color=#88FF88>{no}</color>" + $"     <size=70%><color=#AAAAAA>of {total}  -  {Mathf.CeilToInt(secondsLeft)}s</color></size>" + text3);
		}

		internal void ShowResult(bool passed, int yes, int no, int total)
		{
			Show(passed ? $"<color=#FF3333><b>THE CREW GAVE UP</b></color>\n<size=70%>{yes} of {total} voted yes</size>" : $"<b>THE CREW FIGHTS ON</b>\n<size=70%>{yes} yes, {no} no of {total}</size>");
		}

		internal void Hide()
		{
			if ((Object)(object)canvasObject != (Object)null && canvasObject.activeSelf)
			{
				canvasObject.SetActive(false);
			}
		}

		internal void Destroy()
		{
			if ((Object)(object)canvasObject != (Object)null)
			{
				Object.Destroy((Object)(object)canvasObject);
			}
		}

		private void Show(string message)
		{
			if ((Object)(object)canvasObject == (Object)null)
			{
				Create();
			}
			if (!canvasObject.activeSelf)
			{
				canvasObject.SetActive(true);
			}
			((TMP_Text)text).text = message;
		}

		private void Create()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0046: 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: Expected O, but got Unknown
			//IL_00aa: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Expected O, but got Unknown
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			canvasObject = new GameObject("LostCause Vote");
			Canvas obj = canvasObject.AddComponent<Canvas>();
			obj.renderMode = (RenderMode)0;
			obj.sortingOrder = 60;
			CanvasScaler obj2 = canvasObject.AddComponent<CanvasScaler>();
			obj2.uiScaleMode = (ScaleMode)1;
			obj2.referenceResolution = new Vector2(1920f, 1080f);
			obj2.matchWidthOrHeight = 0.5f;
			GameObject val = new GameObject("Panel", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(canvasObject.transform, false);
			Image obj3 = val.AddComponent<Image>();
			((Graphic)obj3).color = new Color(0f, 0f, 0f, 0.7f);
			((Graphic)obj3).raycastTarget = false;
			RectTransform rectTransform = ((Graphic)obj3).rectTransform;
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 1f);
			rectTransform.anchorMax = val2;
			rectTransform.anchorMin = val2;
			rectTransform.pivot = new Vector2(0.5f, 1f);
			rectTransform.anchoredPosition = new Vector2(0f, -170f);
			rectTransform.sizeDelta = new Vector2(760f, 190f);
			GameObject val3 = new GameObject("Text", new Type[1] { typeof(RectTransform) });
			val3.transform.SetParent(val.transform, false);
			text = val3.AddComponent<TextMeshProUGUI>();
			((TMP_Text)text).alignment = (TextAlignmentOptions)514;
			((TMP_Text)text).fontSize = 30f;
			((Graphic)text).color = Color.white;
			((TMP_Text)text).textWrappingMode = (TextWrappingModes)0;
			((Graphic)text).raycastTarget = false;
			TMP_Text val4 = Object.FindAnyObjectByType<TMP_Text>();
			if ((Object)(object)val4 != (Object)null && (Object)(object)val4.font != (Object)null)
			{
				((TMP_Text)text).font = val4.font;
			}
			RectTransform rectTransform2 = ((TMP_Text)text).rectTransform;
			rectTransform2.anchorMin = Vector2.zero;
			rectTransform2.anchorMax = Vector2.one;
			rectTransform2.offsetMin = new Vector2(16f, 10f);
			rectTransform2.offsetMax = new Vector2(-16f, -10f);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}