Decompiled source of Lockout 3 v0.0.2

plugins/LockoutThree.dll

Decompiled 5 months ago
using System;
using System.CodeDom.Compiler;
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 AK;
using Agents;
using AssetShards;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using CellMenu;
using CroatiaUtils.Extensions;
using FX_EffectSystem;
using GTFO.API;
using GTFO.API.Components;
using GameData;
using Gear;
using Globals;
using HarmonyLib;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppInterop.Runtime.Runtime.VersionSpecific.Class;
using Il2CppSystem;
using LevelGeneration;
using Localization;
using LockoutThree;
using LockoutThree.DataInjection;
using LockoutThree.Extensions;
using LockoutThree.Utils;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("LockoutThree")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+gitbe236e6-dirty-master")]
[assembly: AssemblyProduct("LockoutThree")]
[assembly: AssemblyTitle("LockoutThree")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsUnmanagedAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NativeIntegerAttribute : Attribute
	{
		public readonly bool[] TransformFlags;

		public NativeIntegerAttribute()
		{
			TransformFlags = new bool[1] { true };
		}

		public NativeIntegerAttribute(bool[] P_0)
		{
			TransformFlags = P_0;
		}
	}
}
public class CheckPoint : MonoBehaviour
{
	public int CheckPointIdx;

	public CheckPoint(nint hdl)
		: base((IntPtr)hdl)
	{
	}

	private void OnTriggerEnter(Collider other)
	{
		KartKontroller kartKontroller = ((Component)other).GetComponent<KartKontroller>();
		if ((Object)(object)kartKontroller == (Object)null)
		{
			kartKontroller = ((Component)other).GetComponentInParent<KartKontroller>();
		}
		if ((Object)(object)kartKontroller == (Object)null)
		{
			kartKontroller = ((Component)other).GetComponentInChildren<KartKontroller>();
		}
		if (!((Object)(object)kartKontroller == (Object)null))
		{
			kartKontroller.EnterCheckpoint(this);
		}
	}
}
public class CustomWinScreen : MonoBehaviour
{
	public static RuntimeAnimatorController s_Animator;

	public static string[] s_AnimsByPlayer = new string[4] { "1", "2", "3", "4" };

	private LG_SpotLight[] m_Lights;

	private PlayerAgent m_Winner;

	private List<Transform> m_PlayerTransforms = new List<Transform>();

	public CustomWinScreen(nint hdl)
		: base((IntPtr)hdl)
	{
	}

	public void SpawnPlayerModel(int playerIdx, Transform align, bool winner = false)
	{
		//IL_006b: 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_008b: Unknown result type (might be due to invalid IL or missing references)
		CM_PlayerLobbyBar val = ((Il2CppArrayBase<CM_PlayerLobbyBar>)(object)MainMenuGuiLayer.Current.PageLoadout.m_playerLobbyBars)[playerIdx];
		if ((Object)(object)val == (Object)null || (Object)(object)val.m_modelData == (Object)null)
		{
			return;
		}
		if (winner)
		{
			m_Winner = PlayerManager.PlayerAgentsInLevel[playerIdx];
		}
		GameObject val2 = Object.Instantiate<GameObject>(((Component)val.m_modelData).gameObject, align);
		CustomExtensions.ChangeLayerRecursive(val2, LayerMask.NameToLayer("Default"), (Il2CppStructArray<int>)null);
		val2.transform.localPosition = Vector3.zero;
		val2.transform.localEulerAngles = Vector3.zero;
		val2.transform.localScale = Vector3.one;
		if ((Object)(object)s_Animator != (Object)null && s_AnimsByPlayer.Length >= playerIdx)
		{
			Animator component = val2.GetComponent<Animator>();
			if ((Object)(object)component != (Object)null)
			{
				component.runtimeAnimatorController = s_Animator;
			}
			component.Play(s_AnimsByPlayer[playerIdx]);
		}
		m_PlayerTransforms.Add(align);
	}

	public void TriggerWinSequence()
	{
		m_Lights = Il2CppArrayBase<LG_SpotLight>.op_Implicit(((Component)this).gameObject.GetComponentsInChildren<LG_SpotLight>());
		LG_SpotLight[] lights = m_Lights;
		for (int i = 0; i < lights.Length; i++)
		{
			((Component)lights[i]).gameObject.SetActive(false);
		}
		((MonoBehaviour)this).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(WinSequence()));
	}

	private IEnumerator WinSequence()
	{
		CellSound.Post(3213784005u);
		CellSound.Post(3236674733u);
		yield return (object)new WaitForSeconds(0.5f);
		Debug.Log(Object.op_Implicit("The winner is..."));
		yield return (object)new WaitForSeconds(3f);
		Debug.Log(Object.op_Implicit(m_Winner.Owner.NickName));
		CellSound.Post(847557921u);
		LG_SpotLight[] lights = m_Lights;
		for (int i = 0; i < lights.Length; i++)
		{
			((Component)lights[i]).gameObject.SetActive(true);
		}
		foreach (Transform playerTransform in m_PlayerTransforms)
		{
			((FX_EffectBase)ItemPickupTrigger.ExplosionVFX.AquireEffect()).Play((FX_Trigger)null, playerTransform.position, Quaternion.LookRotation(playerTransform.up));
			CellSound.Post(EVENTS.STICKYMINEEXPLODE, playerTransform.position);
		}
		yield return (object)new WaitForSeconds(0.1f);
		CellSound.Post(2975357637u);
		float elapsed = 0f;
		float duration = 5f;
		while (elapsed < duration)
		{
			float num = Mathf.Sin(Time.time) * 0.25f + 0.75f;
			float num2 = Mathf.Sin(Time.time + 2f) * 0.25f + 0.75f;
			float num3 = Mathf.Sin(Time.time + 4f) * 0.25f + 0.75f;
			lights = m_Lights;
			for (int i = 0; i < lights.Length; i++)
			{
				((LG_Light)lights[i]).ChangeColor(new Color(num, num2, num3, 1f));
			}
			elapsed += Time.deltaTime;
			yield return null;
		}
		GameStateManager.ChangeState((eGameStateName)16);
	}
}
public class ItemPickupTrigger : MonoBehaviour
{
	public struct ItemDefinition
	{
		public uint ID;

		public int ammo;
	}

	public static ItemDefinition[] s_ValidItems = new ItemDefinition[4]
	{
		new ItemDefinition
		{
			ID = 0u,
			ammo = 0
		},
		new ItemDefinition
		{
			ID = 1000u,
			ammo = 5
		},
		new ItemDefinition
		{
			ID = 1001u,
			ammo = 1
		},
		new ItemDefinition
		{
			ID = 1002u,
			ammo = 3
		}
	};

	private float m_RespawnTimestamp;

	private Renderer m_Renderer;

	private Collider m_Collider;

	private static FX_Pool s_ExplosionVFX;

	public static FX_Pool ExplosionVFX
	{
		get
		{
			if ((Object)(object)s_ExplosionVFX == (Object)null)
			{
				s_ExplosionVFX = FX_Manager.GetEffectPool(AssetShardManager.GetLoadedAsset<GameObject>("Assets/AssetPrefabs/FX_Effects/FX_TripmineGlue.prefab", false));
			}
			return s_ExplosionVFX;
		}
	}

	public ItemPickupTrigger(nint hdl)
		: base((IntPtr)hdl)
	{
	}

	private void Start()
	{
		m_Collider = ((Component)this).GetComponent<Collider>();
		m_Renderer = ((Component)this).GetComponent<Renderer>();
	}

	private void OnTriggerEnter(Collider other)
	{
		object obj = ((Component)other).GetComponent<KartKontroller>() ?? ((Component)other).GetComponentInParent<KartKontroller>();
		if (obj == null)
		{
			obj = ((Component)other).GetComponentInChildren<KartKontroller>();
		}
		KartKontroller kartKontroller = (KartKontroller)obj;
		if (!((Object)(object)kartKontroller == (Object)null))
		{
			PlayerAgent driver = kartKontroller.Driver;
			if (!((Object)(object)driver == (Object)null))
			{
				TriggerPickup(driver);
			}
		}
	}

	private void TriggerPickup(PlayerAgent player)
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: 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)
		m_Renderer.enabled = false;
		m_Collider.enabled = false;
		m_RespawnTimestamp = Time.time + 3f;
		player.Sound.Post(EVENTS.GUI_BOOSTER_RECEIVED, true);
		((FX_EffectBase)ExplosionVFX.AquireEffect()).Play((FX_Trigger)null, ((Component)this).transform.position, Quaternion.LookRotation(((Component)this).transform.up));
		CellSound.Post(EVENTS.STICKYMINEEXPLODE, ((Component)this).transform.position);
		if (!PlayerManager.GetLocalPlayerAgent().Owner.IsMaster)
		{
			NetworkAPI.InvokeEvent<int>("SyncRequestItemRNG", player.PlayerSlotIndex, (SNet_ChannelType)2);
		}
		else
		{
			NetworkManager.SyncRequestItemRNG(0uL, player.PlayerSlotIndex);
		}
	}

	private void Update()
	{
		if (!(Time.time < m_RespawnTimestamp) && m_RespawnTimestamp != -1f)
		{
			m_Renderer.enabled = true;
			m_Collider.enabled = true;
			m_RespawnTimestamp = -1f;
		}
	}
}
public class ThrowableSentry : ConsumableInstance
{
	public static GearIDRange s_SentrygunGear = new GearIDRange("{\"Ver\":1,\"Name\":\"Mechatronic B5 LFR\",\"Packet\":{\"Comps\":{\"Length\":11,\"a\":{\"c\":1,\"v\":13},\"b\":{\"c\":2,\"v\":12},\"c\":{\"c\":3,\"v\":97},\"d\":{\"c\":4,\"v\":11},\"e\":{\"c\":5,\"v\":4},\"f\":{\"c\":12,\"v\":13},\"g\":{\"c\":16,\"v\":2},\"h\":{\"c\":27,\"v\":9},\"i\":{\"c\":40,\"v\":2},\"j\":{\"c\":42,\"v\":2}},\"MatTrans\":{\"tDecalA\":{\"scale\":0.1},\"tDecalB\":{\"scale\":0.1},\"tPattern\":{\"scale\":0.1}},\"publicName\":{\"data\":\"Mechatronic B5 LFR\"}}}");

	private Rigidbody m_RigidBody;

	private float m_Timestamp;

	public ThrowableSentry(nint hdl)
		: base((IntPtr)hdl)
	{
	}

	private void Start()
	{
		m_RigidBody = ((Component)this).GetComponent<Rigidbody>();
		m_Timestamp = Time.time;
	}

	private void OnCollisionEnter(Collision other)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0021: 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)
		ContactPoint val = ((Il2CppArrayBase<ContactPoint>)(object)other.contacts)[0];
		Vector3 point = ((ContactPoint)(ref val)).point;
		val = ((Il2CppArrayBase<ContactPoint>)(object)other.contacts)[0];
		SpawnSentrygun(point, Quaternion.Euler(((ContactPoint)(ref val)).normal));
	}

	private void Update()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: 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_003e: Unknown result type (might be due to invalid IL or missing references)
		Vector3 velocity = m_RigidBody.velocity;
		if (((Vector3)(ref velocity)).magnitude < 1f && Time.time - m_Timestamp > 1f)
		{
			SpawnSentrygun(((Component)this).transform.position, Quaternion.Euler(Vector3.up));
		}
	}

	private void SpawnSentrygun(Vector3 position, Quaternion rotation)
	{
		//IL_000f: 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)
		if (SNet.IsMaster)
		{
			ItemReplicationManager.SpawnGear(s_SentrygunGear, (delItemCallback)null, (ItemMode)3, position, rotation, ((Agent)PlayerManager.GetLocalPlayerAgent()).CourseNode, ((Item)this).Owner, 999999f, 999999f);
			((Item)this).ReplicationWrapper.Replicator.Despawn();
		}
	}
}
public class ThrowableTripmine : ConsumableInstance
{
	private Rigidbody m_RigidBody;

	private float m_Timestamp;

	public ThrowableTripmine(nint hdl)
		: base((IntPtr)hdl)
	{
	}

	private void Start()
	{
		m_RigidBody = ((Component)this).GetComponent<Rigidbody>();
		m_Timestamp = Time.time;
	}

	private void OnCollisionEnter(Collision other)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: 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)
		ContactPoint val = ((Il2CppArrayBase<ContactPoint>)(object)other.contacts)[0];
		SpawnMine(((ContactPoint)(ref val)).point, Quaternion.Euler(90f, 0f, 0f));
	}

	private void Update()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: 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)
		Vector3 velocity = m_RigidBody.velocity;
		if (((Vector3)(ref velocity)).magnitude < 1f && Time.time - m_Timestamp > 1f)
		{
			SpawnMine(((Component)this).transform.position, Quaternion.Euler(90f, 0f, 0f));
		}
	}

	private void SpawnMine(Vector3 position, Quaternion rotation)
	{
		//IL_0002: 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_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		pItemData val = default(pItemData);
		val.itemID_gearCRC = 125u;
		ItemReplicationManager.SpawnItem(val, (delItemCallback)null, (ItemMode)3, position, rotation, ((Agent)PlayerManager.GetLocalPlayerAgent()).CourseNode, PlayerManager.GetLocalPlayerAgent());
		((Item)this).ReplicationWrapper.Replicator.Despawn();
	}
}
public class KartDamage : MonoBehaviour
{
	public KartKontroller Kart;

	public Vector3 DamageTargetPos => ((Component)this).transform.position;

	public string DebugName => "(10c)d0cr3d";

	public uint TempSearchID { get; set; }

	public bool IgnoreGlue => true;

	public KartDamage(nint hdl)
		: base((IntPtr)hdl)
	{
	}

	public void BulletDamage(float dam, Agent sourceAgent, Vector3 position, Vector3 direction, Vector3 normal, bool allowDirectionalBonus = false, float staggerMulti = 1f, float precisionMulti = 1f, uint gearCategoryId = 0u)
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)Kart == (Object)null))
		{
			SyncKartImpulse(dam * 8000f * MathF.Max(precisionMulti, 1f) * Mathf.Max(staggerMulti, 1f), position, 50f, 1.5f);
		}
	}

	public void ExplosionDamage(float dam, Vector3 sourcePos, Vector3 force, uint gearCategoryId = 0u)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)Kart == (Object)null))
		{
			SyncKartImpulse(((Vector3)(ref force)).magnitude * 8f, sourcePos - Vector3.up, 50f, 3f);
		}
	}

	public void MeleeDamage(float dam, Agent sourceAgent, Vector3 position, Vector3 direction, float staggerMulti = 1f, float precisionMulti = 1f, float environmentMulti = 1f, float backstabberMulti = 1f, float sleeperMulti = 1f, bool skipLimbDestruction = false, DamageNoiseLevel damageNoiseLevel = 0, uint gearCategoryId = 0u)
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)Kart == (Object)null) && !((Object)(object)sourceAgent == (Object)(object)Kart.Driver))
		{
			SyncKartImpulse(800000f, position, 50f, 3f);
		}
	}

	public void FireDamage(float dam, Agent sourceAgent)
	{
	}

	public void FreezeDamage(float dam, Agent sourceAgent)
	{
	}

	public void GlueDamage(float glueAmount)
	{
	}

	public void PushDamage(float dam, Agent sourceAgent, Vector3 position, Vector3 direction)
	{
	}

	public void TentacleAttackDamage(float dam, Agent sourceAgent, Vector3 position)
	{
	}

	public void TentacleTrapGrabDamage(float dam, uint staticEnemyID)
	{
	}

	public void ParasiteTrapDamage(float dam, uint staticEnemyID)
	{
	}

	public void TentacleTankGrabDamage(float dam, Agent sourceAgent)
	{
	}

	public void TentacleGrabStop()
	{
	}

	public void ShooterProjectileDamage(float dam, Vector3 position)
	{
	}

	public void FallDamage(float dam)
	{
	}

	public void NoAirDamage(float dam)
	{
	}

	public void ParasiteDamage(float dam)
	{
	}

	public IDamageable GetBaseDamagable()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		return new IDamageable(((Il2CppObjectBase)this).Pointer);
	}

	public Agent GetBaseAgent()
	{
		if ((Object)(object)Kart != (Object)null)
		{
			return (Agent)(object)Kart.Driver;
		}
		return null;
	}

	public float GetHealthRel()
	{
		return float.MaxValue;
	}

	public void SyncKartImpulse(float explosionForce, Vector3 explosionPosition, float explosionRadius, float upwardsModifier)
	{
		//IL_000c: 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_0057: Unknown result type (might be due to invalid IL or missing references)
		Kart.RigidBody.AddExplosionForce(explosionForce, explosionPosition, explosionRadius, upwardsModifier);
		if ((Object)(object)Kart.Driver != (Object)null && (Object)(object)Kart.Driver != (Object)(object)PlayerManager.GetLocalPlayerAgent())
		{
			NetworkAPI.InvokeEvent<pImpulse>("SyncKartImpulse", new pImpulse
			{
				force = explosionForce,
				position = explosionPosition,
				radius = explosionRadius,
				upwardsModifier = upwardsModifier,
				kartIdx = Kart.Driver.PlayerSlotIndex
			}, (SNet_ChannelType)2);
		}
	}
}
public class KartKontroller : MonoBehaviour
{
	public static KartKontroller[] s_Karts;

	public static CheckPoint[] s_Checkpoints;

	public static double GLOBAL_LAP_DIST = double.MaxValue;

	public static Dictionary<int, double> LAP_DIST_LOOKUP = null;

	public PlayerAgent Driver;

	public int LapCount;

	private PlayerCharacterController m_Ctrl;

	private float m_Torque;

	private float m_Brake;

	private float m_SteerAngle;

	private float m_MaxSpeed;

	private float m_SteerDrag;

	private float m_RespawnTriggerHeight;

	private Vector3 m_RespawnPos;

	private Vector3 m_RespawnEuler;

	private int m_PreviousCheckpointIdx;

	private int m_CurrentCheckpointIdx;

	private int m_CurrentFakeCheckpointIdx;

	public Rigidbody RigidBody;

	private BoxCollider m_Collider;

	private KartDamage m_Damage;

	private float m_LapTimestamp;

	private float m_RaceTime;

	private long Score
	{
		get
		{
			//IL_0043: 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_0060: 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_006e: 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)
			double num = GLOBAL_LAP_DIST * (double)LapCount;
			double num2 = LAP_DIST_LOOKUP[m_CurrentCheckpointIdx];
			double num3 = num + num2;
			if (m_CurrentCheckpointIdx + 1 < s_Checkpoints.Length)
			{
				Vector3 position = ((Component)s_Checkpoints[m_CurrentCheckpointIdx]).transform.position;
				Vector3 position2 = ((Component)s_Checkpoints[m_CurrentCheckpointIdx + 1]).transform.position;
				double num4 = MathUtils.FastVector3Dist(position, position2);
				double num5 = MathUtils.FastVector3Dist(((Component)this).transform.position, position2);
				num3 += num4 - num5;
			}
			return (long)Math.Floor(num3);
		}
	}

	private float Speedboost
	{
		get
		{
			if ((Object)(object)Driver == (Object)null)
			{
				return 1f;
			}
			return Mathf.Max((Driver.MeleeBuffTimer - Clock.Time) * 0.4f, 1f);
		}
	}

	private Color RainbowColor => new Color(Mathf.Sin(Time.time * 3f) * 0.5f + 0.5f, Mathf.Sin(Time.time * 3f + 2f) * 0.5f + 0.5f, Mathf.Sin(Time.time * 3f + 4f) * 0.5f + 0.5f, 1f);

	public KartKontroller(nint hdl)
		: base((IntPtr)hdl)
	{
	}

	private static double DistanceBetweenCheckpoints(int a, int b)
	{
		CheckPoint[] abCheckpoints = s_Checkpoints[a..b];
		return abCheckpoints.Select((CheckPoint x) => ((Component)x).transform.position).SelectMany((Vector3 x, int idx) => from x in abCheckpoints.Skip(idx + 1)
			select ((Component)x).transform.position into y
			select MathUtils.FastVector3Dist(x, y)).Sum();
	}

	private void Start()
	{
		//IL_0073: 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_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: 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)
		RigidBody = ((Component)this).GetComponent<Rigidbody>();
		m_Collider = ((Component)this).GetComponent<BoxCollider>();
		m_Damage = ((Component)this).gameObject.AddComponent<KartDamage>();
		m_Damage.Kart = this;
		m_Torque = 200f;
		m_Brake = 2.4f;
		m_SteerAngle = 15f;
		m_MaxSpeed = 120f;
		m_SteerDrag = 25f;
		Rigidbody rigidBody = RigidBody;
		rigidBody.centerOfMass -= Vector3.up * 0.1f;
		RigidBody.AddForce(((Component)this).transform.forward * 25f);
	}

	[HideFromIl2Cpp]
	public void Setup(PlayerAgent driver)
	{
		//IL_0026: 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_0047: 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_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_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		Debug.LogWarning(Object.op_Implicit("kart setup - " + driver.Owner.NickName));
		m_RespawnTriggerHeight = ((Component)this).transform.position.y - 128f;
		m_RespawnPos = ((Component)this).transform.position;
		m_RespawnEuler = new Vector3(0f, ((Component)this).transform.eulerAngles.y, 0f);
		Transform transform = ((Component)this).transform;
		transform.position += Vector3.up;
		Transform transform2 = ((Component)this).transform;
		transform2.position -= ((Component)this).transform.forward;
		m_RaceTime = 0f;
		AttachPlayer(driver);
	}

	[HideFromIl2Cpp]
	public void EnterCheckpoint(CheckPoint checkpoint)
	{
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		int checkPointIdx = checkpoint.CheckPointIdx;
		if (checkPointIdx == m_CurrentFakeCheckpointIdx || (Object)(object)Driver == (Object)null || (Object)(object)Driver != (Object)(object)PlayerManager.GetLocalPlayerAgent())
		{
			return;
		}
		bool flag = checkPointIdx == s_Checkpoints.Length - 1;
		if (m_CurrentCheckpointIdx == s_Checkpoints.Length - 1 && checkPointIdx == 0)
		{
			LapCount++;
			Debug.Log(Object.op_Implicit($"New lap! {LapCount}"));
			m_LapTimestamp = Time.time + 3f;
			Driver.Sound.Post(2975357637u, true);
			_ = $"Lap {LapCount + 1}";
			_ = LapCount;
			_ = 2;
			GuiManager.PlayerLayer.m_objectiveTimer.UpdateTimerTitle($"Lap {LapCount + 1}");
			if (LapCount > 2)
			{
				pScoreData pScoreData2 = default(pScoreData);
				pScoreData2.kart0score = s_Karts[0].Score;
				pScoreData2.kart1score = s_Karts[1].Score;
				pScoreData2.kart2score = s_Karts[2].Score;
				pScoreData2.kart3score = s_Karts[3].Score;
				pScoreData pScoreData3 = pScoreData2;
				NetworkAPI.InvokeEvent<pScoreData>("SyncEndRace", pScoreData3, (SNet_ChannelType)2);
				NetworkManager.SyncEndRace(0uL, pScoreData3);
			}
		}
		else if ((m_CurrentFakeCheckpointIdx > checkPointIdx && checkPointIdx != 0) || (m_CurrentCheckpointIdx == 0 && flag))
		{
			m_CurrentFakeCheckpointIdx = checkPointIdx;
			return;
		}
		Debug.Log(Object.op_Implicit($"Checkpoint! {checkPointIdx}"));
		m_RespawnPos = ((Component)checkpoint).transform.position;
		m_RespawnEuler = ((Component)checkpoint).transform.eulerAngles;
		m_PreviousCheckpointIdx = m_CurrentCheckpointIdx;
		m_CurrentCheckpointIdx = checkPointIdx;
		m_CurrentFakeCheckpointIdx = checkPointIdx;
	}

	private void FixedUpdate()
	{
		//IL_0058: 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_0086: 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_002d: 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_00e5: 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_00f4: 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_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: 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_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_0236: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: 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_027f: Unknown result type (might be due to invalid IL or missing references)
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_029a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0259: Unknown result type (might be due to invalid IL or missing references)
		//IL_0200: 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_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: Unknown result type (might be due to invalid IL or missing references)
		//IL_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0327: Unknown result type (might be due to invalid IL or missing references)
		//IL_0331: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Driver != (Object)null && (Object)(object)m_Ctrl != (Object)null)
		{
			Driver.PlayerCharacterController.Position = ((Component)this).transform.position;
			Driver.PlayerCharacterController.m_smoothPosition = ((Component)this).transform.position;
		}
		if (((Component)this).transform.position.y < m_RespawnTriggerHeight)
		{
			Respawn();
		}
		if (!Physics.Raycast(((Component)m_Collider).transform.position, ((Component)this).transform.up * -1f, 0.35f, LayerMask.GetMask(new string[1] { "Default" })) || (Object)(object)Driver == (Object)null || (Object)(object)Driver != (Object)(object)PlayerManager.GetLocalPlayerAgent())
		{
			return;
		}
		Vector3 val = 50f * Vector3.Cross(((Component)RigidBody).transform.up, Vector3.up);
		Vector3 val2 = 50f * -RigidBody.angularVelocity;
		RigidBody.AddTorque(val + val2, (ForceMode)5);
		float num = (Input.GetKey((KeyCode)119) ? 1 : 0) + (Input.GetKey((KeyCode)115) ? (-1) : 0);
		float num2 = (Input.GetKey((KeyCode)100) ? 1 : 0) + (Input.GetKey((KeyCode)97) ? (-1) : 0);
		float num3 = m_Torque * num * Speedboost;
		float num4 = m_SteerAngle * num2;
		float num5 = ((num3 == 0f) ? m_Brake : 0f);
		Vector3 val3 = ((Component)this).transform.forward * num3 * Time.fixedDeltaTime;
		Vector3 velocity = RigidBody.velocity;
		if (((Vector3)(ref velocity)).magnitude < 1f)
		{
			val3 += Vector3.up * 100f * Time.fixedDeltaTime;
			if (num3 > 0f)
			{
				Transform transform = ((Component)this).transform;
				transform.localEulerAngles += Vector3.right * (0f - num3) * 0.5f * Time.fixedDeltaTime;
			}
		}
		velocity = RigidBody.velocity;
		if (((Vector3)(ref velocity)).magnitude < m_MaxSpeed * Speedboost)
		{
			RigidBody.AddForce(val3, (ForceMode)5);
		}
		RigidBody.velocity = Vector3.Lerp(RigidBody.velocity, Vector3.zero, num5 * Time.fixedDeltaTime);
		float num6 = Vector3.Dot(RigidBody.velocity, ((Component)this).transform.forward);
		float num7 = num4;
		velocity = RigidBody.velocity;
		num4 = num7 * Mathf.Lerp(4f, 1f, ((Vector3)(ref velocity)).magnitude * 0.05f);
		if (num4 != 0f)
		{
			RigidBody.angularVelocity = new Vector3(RigidBody.angularVelocity.x, RigidBody.angularVelocity.y + Mathf.Sqrt(Mathf.Abs(num6)) * Mathf.Sign(num6) * num4 * Time.fixedDeltaTime, RigidBody.angularVelocity.z);
		}
		RigidBody.angularDrag = ((num4 == 0f) ? m_SteerDrag : 0f);
	}

	private void Update()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: 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_0077: 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_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_00cb: 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)
		if (Physics.Raycast(((Component)m_Collider).transform.position, Vector3.up * -1f, 1f, LayerMask.GetMask(new string[1] { "Default" })) && !((Object)(object)Driver == (Object)null) && !((Object)(object)Driver != (Object)(object)PlayerManager.GetLocalPlayerAgent()))
		{
			m_RaceTime += Time.deltaTime;
			Color val = Color.white;
			if (m_LapTimestamp > Time.time)
			{
				val = RainbowColor;
			}
			GuiManager.PlayerLayer.m_objectiveTimer.UpdateTimerText(m_RaceTime, 9999999f, val);
			((Dam_SyncedDamageBase)Driver.Damage).Health = 500f;
			if (Input.GetKeyDown((KeyCode)32))
			{
				RigidBody.AddForce(Vector3.up * 8000f, (ForceMode)1);
			}
			PushKartPacket();
		}
	}

	[HideFromIl2Cpp]
	public void AttachPlayer(PlayerAgent driver)
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		Debug.LogWarning(Object.op_Implicit("attach player - " + driver.Owner.NickName));
		driver.Locomotion.ChangeState((PLOC_State)1, false);
		((Component)driver).transform.position = ((Component)this).transform.position;
		((Component)driver).transform.parent = ((Component)this).transform;
		((Behaviour)driver.Locomotion).enabled = false;
		m_Ctrl = driver.PlayerCharacterController;
		if ((Object)(object)m_Ctrl != (Object)null)
		{
			((Behaviour)m_Ctrl).enabled = false;
		}
		driver.PlayerSyncModel.m_tentacleTarget = ((Component)this).transform;
		((Dam_SyncedDamageBase)driver.Damage).Health = 500f;
		((Dam_SyncedDamageBase)driver.Damage).HealthMax = 500f;
		Driver = driver;
		((Object)this).name = ((Object)this).name + "_(" + driver.Owner.NickName + ")";
	}

	[HideFromIl2Cpp]
	public void DetatchPlayer()
	{
		if ((Object)(object)Driver != (Object)null)
		{
			Debug.LogWarning(Object.op_Implicit("detatch player"));
			if ((Object)(object)Driver.PlayerCharacterController != (Object)null)
			{
				((Behaviour)Driver.PlayerCharacterController).enabled = true;
			}
			((Component)Driver).transform.parent = null;
		}
		((Behaviour)this).enabled = false;
		((Component)this).gameObject.SetActive(false);
	}

	[HideFromIl2Cpp]
	private void PushKartPacket()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: 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_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		pKartPos pKartPos2 = default(pKartPos);
		pKartPos2.kartIdx = Driver.PlayerSlotIndex;
		pKartPos2.position = ((Component)this).transform.position;
		pKartPos2.euler = ((Component)this).transform.eulerAngles;
		pKartPos2.velocity = RigidBody.velocity;
		pKartPos2.angVelocity = RigidBody.angularVelocity;
		pKartPos pKartPos3 = pKartPos2;
		NetworkAPI.InvokeEvent<pKartPos>("SyncKartPos", pKartPos3, (SNet_ChannelType)2);
	}

	[HideFromIl2Cpp]
	public void Respawn()
	{
		//IL_0006: 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_0027: 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)
		RigidBody.velocity = Vector3.zero;
		RigidBody.angularVelocity = Vector3.zero;
		((Component)this).transform.eulerAngles = m_RespawnEuler;
		((Component)this).transform.position = m_RespawnPos;
	}
}
public class SentryGunTimer : MonoBehaviour
{
	private SentryGunInstance m_Sentry;

	private float m_DetonateTimestamp;

	private float m_FastBeepTimestamp;

	private float m_BeepTimestamp;

	private float m_BeepDelay;

	private static FX_Pool s_ExplosionVFX;

	public static FX_Pool ExplosionVFX
	{
		get
		{
			if ((Object)(object)s_ExplosionVFX == (Object)null)
			{
				s_ExplosionVFX = FX_Manager.GetEffectPool(AssetShardManager.GetLoadedAsset<GameObject>("Assets/AssetPrefabs/FX_Effects/FX_Tripmine.prefab", false));
			}
			return s_ExplosionVFX;
		}
	}

	public SentryGunTimer(nint hdl)
		: base((IntPtr)hdl)
	{
	}

	private void Start()
	{
		m_Sentry = ((Component)this).GetComponent<SentryGunInstance>();
		m_DetonateTimestamp = Time.time + 20f;
		m_FastBeepTimestamp = (m_DetonateTimestamp -= 3f);
		m_BeepDelay = 1f;
		m_BeepTimestamp = Time.time + m_BeepDelay;
	}

	private void Update()
	{
		if (Time.time > m_BeepTimestamp)
		{
			if (Time.time > m_FastBeepTimestamp)
			{
				m_BeepDelay = 0.25f;
			}
			((ItemEquippable)m_Sentry).Sound.Post(EVENTS.TERMINAL_PING_MARKER_SFX, true);
			m_BeepTimestamp += m_BeepDelay;
		}
		if (Time.time > m_DetonateTimestamp)
		{
			Detonate();
		}
	}

	[HideFromIl2Cpp]
	private void Detonate()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: 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_0060: 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)
		((FX_EffectBase)ExplosionVFX.AquireEffect()).Play((FX_Trigger)null, ((Component)m_Sentry).transform.position, Quaternion.LookRotation(((Component)m_Sentry).transform.up));
		CellSound.Post(EVENTS.STICKYMINEEXPLODE, ((Component)m_Sentry).transform.position);
		DamageUtil.DoExplosionDamage(((Component)m_Sentry).transform.position + Vector3.up * 0.25f, 20f, 0f, LayerManager.MASK_PROJECTILE_BLOCKERS, 0, true, 100000f);
		ItemReplicationManager.DeSpawn(m_Sentry.Replicator);
	}
}
[HarmonyPatch(typeof(LayerManager))]
internal class LayerManager_Hooks
{
	[HarmonyPatch("Setup")]
	[HarmonyPostfix]
	[HarmonyWrapSafe]
	public static void Setup_Postfix(LayerManager __instance)
	{
		LayerManager.MASK_MELEE_ATTACK_TARGETS_WITH_STATIC = __instance.GetMask(new string[7] { "EnemyDamagable", "Dynamic", "Default", "Default_NoGraph", "Default_BlockGraph", "EnemyDead", "ProjectileBlocker" });
		LayerManager.MASK_ENEMY_DAMAGABLE = __instance.GetMask(new string[5] { "EnemyDamagable", "Dynamic", "PlayerMover", "PlayerSynced", "ProjectileBlocker" });
		LayerManager.MASK_STICKY_MINE_TARGETS = __instance.GetMask(new string[8] { "EnemyDamagable", "Default", "Default_NoGraph", "Default_BlockGraph", "Dynamic", "PlayerMover", "PlayerSynced", "ProjectileBlocker" });
	}
}
[HarmonyPatch]
internal class SentryGun_Hooks
{
	[HarmonyPostfix]
	[HarmonyPatch(typeof(SentryGunInstance_Detection), "Setup")]
	public static void SentryGunInstance_Detection_Setup(SentryGunInstance_Detection __instance)
	{
		__instance.m_targetPlayers = true;
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(SentryGunInstance_ScannerVisuals_Plane), "Setup")]
	public static void SentryGunInstance_ScannerVisuals_Plane_Setup(SentryGunInstance_ScannerVisuals_Plane __instance)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		__instance.m_scanningColor = new Color(0.78f, 0.4f, 0f, 1f);
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(SentryGunPlacementIndicator), "SetVisible")]
	public static void SentryGunPlacementIndicator_SetVisible(SentryGunPlacementIndicator __instance)
	{
		__instance.m_raycastCorners = new Il2CppReferenceArray<Transform>(0L);
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(SentryGunInstance), "OnGearSpawnComplete")]
	public static void SentryGunInstance_OnGearSpawnComplete(SentryGunInstance __instance)
	{
		((Component)__instance).gameObject.AddComponent<SentryGunTimer>();
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(SentryGunInstance), "TryGetTargetAimPos")]
	public static void SentryGunInstance_TryGetTargetAimPos(ref Vector3 pos)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: 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)
		pos -= Vector3.up;
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(SentryGunInstance), "OnSpawn")]
	public static void SentryGunInstance_OnSpawn(SentryGunInstance __instance)
	{
		((Item)__instance).Owner = null;
	}
}
[HarmonyPatch]
internal class Tripmine_Hooks
{
	[HarmonyPostfix]
	[HarmonyPatch(typeof(MineDeployerInstance_Detonate_Explosive), "Setup")]
	public static void MineDeployerInstance_Detonate_Explosive_Setup(MineDeployerInstance_Detonate_Explosive __instance)
	{
		MineDeployerInstance_Detonate_Explosive __instance2 = __instance;
		__instance2.OnDetonationDone += Action.op_Implicit((Action)delegate
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			DamageUtil.DoExplosionDamage(((Component)__instance2).transform.position + Vector3.up * 0.25f, 40f, 0f, LayerManager.MASK_PROJECTILE_BLOCKERS, 0, true, 100000f);
		});
		((Collider)((Component)((Component)__instance2).gameObject.GetComponentInChildren<GenericDamageComponent>()).gameObject.GetComponent<BoxCollider>()).enabled = false;
	}
}
public class NetworkManager
{
	public static void Setup()
	{
		NetworkAPI.RegisterEvent<pKartPos>("SyncKartPos", (Action<ulong, pKartPos>)SyncKartPos);
		NetworkAPI.RegisterEvent<pImpulse>("SyncKartImpulse", (Action<ulong, pImpulse>)SyncKartImpulse);
		NetworkAPI.RegisterEvent<pScoreData>("SyncEndRace", (Action<ulong, pScoreData>)SyncEndRace);
		NetworkAPI.RegisterEvent<int>("SyncRequestItemRNG", (Action<ulong, int>)SyncRequestItemRNG);
		NetworkAPI.RegisterEvent<pItemPickup>("SyncPickupItembox", (Action<ulong, pItemPickup>)SyncPickupItembox);
		NetworkAPI.RegisterEvent<int>("TriggerKartEntry", (Action<ulong, int>)SyncKartEntry);
	}

	public static void SyncKartPos(ulong x, pKartPos kartPos)
	{
		//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_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		if (KartKontroller.s_Karts != null)
		{
			if (KartKontroller.s_Karts.Length < kartPos.kartIdx)
			{
				Debug.LogError(Object.op_Implicit($"Attempting to refresh a kart outside of the array! wrf... bro this is not ok... ulong x {x} - kartidx {kartPos.kartIdx}"));
			}
			else
			{
				KartKontroller obj = KartKontroller.s_Karts[kartPos.kartIdx];
				obj.RigidBody.velocity = kartPos.velocity;
				obj.RigidBody.angularVelocity = kartPos.angVelocity;
				((Component)obj).transform.position = kartPos.position;
				((Component)obj).transform.eulerAngles = kartPos.euler;
			}
		}
	}

	public static void SyncKartEntry(ulong x, int y)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_02db: Unknown result type (might be due to invalid IL or missing references)
		EnvironmentStateManager.AttemptLightningStrike(Vector3.down, Color.red);
		Dimension val = default(Dimension);
		LG_LevelBuilder.Current.m_currentFloor.GetDimension((eDimensionIndex)1, ref val);
		Transform transform = ((Component)val.DimensionLevel).transform;
		((Component)transform.GetChild(4).FindChild("Floor")).gameObject.SetActive(false);
		KartKontroller.s_Karts = new KartKontroller[4]
		{
			((Component)transform.FindChild("Kart1").GetChild(0)).gameObject.AddComponent<KartKontroller>(),
			((Component)transform.FindChild("Kart2").GetChild(0)).gameObject.AddComponent<KartKontroller>(),
			((Component)transform.FindChild("Kart3").GetChild(0)).gameObject.AddComponent<KartKontroller>(),
			((Component)transform.FindChild("Kart4").GetChild(0)).gameObject.AddComponent<KartKontroller>()
		};
		if (KartKontroller.s_Checkpoints == null)
		{
			List<CheckPoint> list = new List<CheckPoint>();
			Transform val2 = transform.FindChild("Checkpoints");
			for (int i = 0; i < val2.childCount; i++)
			{
				list.Add(((Component)val2.GetChild(i)).gameObject.AddComponent<CheckPoint>());
				list[i].CheckPointIdx = i;
			}
			KartKontroller.s_Checkpoints = list.ToArray();
			KartKontroller.GLOBAL_LAP_DIST = DistanceBetweenCheckpoints(0, KartKontroller.s_Checkpoints.Length);
			KartKontroller.LAP_DIST_LOOKUP = new Dictionary<int, double>();
			CheckPoint[] s_Checkpoints = KartKontroller.s_Checkpoints;
			foreach (CheckPoint checkPoint in s_Checkpoints)
			{
				KartKontroller.LAP_DIST_LOOKUP[checkPoint.CheckPointIdx] = KartKontroller.GLOBAL_LAP_DIST - DistanceBetweenCheckpoints(checkPoint.CheckPointIdx, KartKontroller.s_Checkpoints.Length);
			}
		}
		Transform val3 = transform.FindChild("Items");
		for (int k = 0; k < val3.childCount; k++)
		{
			((Component)val3.GetChild(k)).gameObject.AddComponent<ItemPickupTrigger>();
		}
		Debug.LogWarning(Object.op_Implicit($"s_Karts - {KartKontroller.s_Karts.Length}"));
		for (int l = 0; l < PlayerManager.PlayerAgentsInLevel.Count; l++)
		{
			PlayerAgent val4 = PlayerManager.PlayerAgentsInLevel[l];
			if (!((Object)(object)val4 == (Object)null))
			{
				Debug.LogWarning(Object.op_Implicit($"{val4.Owner.NickName} - {val4.PlayerSlotIndex}"));
				KartKontroller.s_Karts[val4.PlayerSlotIndex].Setup(val4);
				val4.Sound.Post(EVENTS.HACKING_PUZZLE_SUCCESS, true);
			}
		}
		EntryPoint.MusicPlayer.Post(1498076536u, true);
		GuiManager.PlayerLayer.m_objectiveTimer.SetTimerActive(true, true);
		GuiManager.PlayerLayer.m_objectiveTimer.UpdateTimerText(0f, 99999f, Color.white);
		GuiManager.PlayerLayer.m_objectiveTimer.UpdateTimerTitle("Lap 0");
		static double DistanceBetweenCheckpoints(int a, int b)
		{
			CheckPoint[] abCheckpoints = KartKontroller.s_Checkpoints[a..b];
			return abCheckpoints.Select((CheckPoint x) => ((Component)x).transform.position).SelectMany((Vector3 x, int idx) => from x in abCheckpoints.Skip(idx + 1)
				select ((Component)x).transform.position into y
				select MathUtils.FastVector3Dist(x, y)).Sum();
		}
	}

	public static void SyncKartImpulse(ulong x, pImpulse impulse)
	{
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		if (KartKontroller.s_Karts != null)
		{
			if (KartKontroller.s_Karts.Length < impulse.kartIdx)
			{
				Debug.LogError(Object.op_Implicit($"Attempting to refresh a kart outside of the array! wrf... bro this is not ok... ulong x {x} - kartidx {impulse.kartIdx}"));
			}
			else
			{
				KartKontroller.s_Karts[impulse.kartIdx].RigidBody.AddExplosionForce(impulse.force, impulse.position, impulse.radius, impulse.upwardsModifier);
			}
		}
	}

	public static void SyncEndRace(ulong x, pScoreData score)
	{
		//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_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Expected O, but got Unknown
		//IL_0146: 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)
		KartKontroller[] s_Karts = KartKontroller.s_Karts;
		for (int i = 0; i < s_Karts.Length; i++)
		{
			s_Karts[i].DetatchPlayer();
		}
		WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(new WardenObjectiveEventData
		{
			Type = (eWardenObjectiveEventType)8,
			DimensionIndex = (eDimensionIndex)2,
			Delay = 0f,
			Trigger = (eWardenObjectiveEventTrigger)1
		}, (eWardenObjectiveEventTrigger)1, true, 0f);
		Dimension val = default(Dimension);
		LG_LevelBuilder.Current.m_currentFloor.GetDimension((eDimensionIndex)2, ref val);
		CustomWinScreen customWinScreen = ((Component)val.DimensionLevel).gameObject.AddComponent<CustomWinScreen>();
		long[] array = new long[4]
		{
			score.kart0score * 1000,
			score.kart1score * 1000 + 1,
			score.kart2score * 1000 + 2,
			score.kart3score * 1000 + 3
		};
		long[] array2 = array;
		Array.Sort(array2);
		Array.Reverse(array2);
		for (int j = 0; j < 4; j++)
		{
			customWinScreen.SpawnPlayerModel(Array.IndexOf(array, array2[j]), val.DimensionLevel.m_spawnPoints[j + 4], j == 0);
		}
		customWinScreen.TriggerWinSequence();
		FPSCamera fPSCamera = PlayerManager.GetLocalPlayerAgent().FPSCamera;
		((Component)fPSCamera).transform.parent = ((Component)val.DimensionLevel).transform.FindChild("CameraAlign");
		((Component)fPSCamera).transform.localPosition = Vector3.zero;
		((Component)fPSCamera).transform.localEulerAngles = Vector3.zero;
		fPSCamera.OverrideFieldOfView(90f);
		((Behaviour)((Component)fPSCamera).GetComponent<UI_Apply>()).enabled = false;
		((Behaviour)((Component)fPSCamera).GetComponent<AmbientParticles>()).enabled = false;
	}

	public static void SyncRequestItemRNG(ulong x, int playerIdx)
	{
		if (SNet.IsMaster)
		{
			PlayerAgent driver = KartKontroller.s_Karts[playerIdx].Driver;
			float value = Random.value;
			value *= (float)ItemPickupTrigger.s_ValidItems.Length;
			Mathf.Round(value);
			ItemPickupTrigger.ItemDefinition itemDefinition = ItemPickupTrigger.s_ValidItems[(uint)value];
			pItemPickup pItemPickup2 = default(pItemPickup);
			pItemPickup2.playerIdx = driver.PlayerSlotIndex;
			pItemPickup2.itemID = itemDefinition.ID;
			pItemPickup2.Ammo = itemDefinition.ammo;
			pItemPickup pItemPickup3 = pItemPickup2;
			NetworkAPI.InvokeEvent<pItemPickup>("SyncPickupItembox", pItemPickup3, (SNet_ChannelType)2);
			SyncPickupItembox(0uL, pItemPickup3);
		}
	}

	public static void SyncPickupItembox(ulong x, pItemPickup item)
	{
		PlayerAgent driver = KartKontroller.s_Karts[item.playerIdx].Driver;
		PlayerAmmoStorage ammoStorage = PlayerBackpackManager.GetBackpack(driver.Owner).AmmoStorage;
		if (item.itemID == 0)
		{
			if ((Object)(object)driver == (Object)(object)PlayerManager.GetLocalPlayerAgent())
			{
				ammoStorage.StandardAmmo.AddAmmo(99999f);
				ammoStorage.SpecialAmmo.AddAmmo(99999f);
				ammoStorage.ClassAmmo.AddAmmo(99999f);
				Debug.Log(Object.op_Implicit("Max ammo!"));
				CellSound.Post(4007102400u);
			}
		}
		else
		{
			ammoStorage.ConsumableAmmo.AmmoInPack = 0f;
			driver.GiveItem((InventorySlot)5, item.itemID, item.Ammo);
			ammoStorage.UpdateAllAmmoUI();
		}
	}
}
public struct pKartPos
{
	public int kartIdx;

	public Vector3 velocity;

	public Vector3 angVelocity;

	public Vector3 position;

	public Vector3 euler;
}
public struct pImpulse
{
	public int kartIdx;

	public float force;

	public Vector3 position;

	public float radius;

	public float upwardsModifier;
}
public struct pScoreData
{
	public long kart0score;

	public long kart1score;

	public long kart2score;

	public long kart3score;
}
public struct pItemPickup
{
	public int playerIdx;

	public uint itemID;

	public int Ammo;
}
namespace LockoutThree
{
	[BepInPlugin("gay.giagg.lockout3", "Lockout3", "1.0.0")]
	public class EntryPoint : BasePlugin
	{
		private Harmony m_Harmony;

		public static CellSoundPlayer MusicPlayer = new CellSoundPlayer();

		public override void Load()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			CM_PageLoadout_CustomData.OFFSET = Il2CppFieldExtender.InjectSizedDataIntoType<CM_PageLoadout, CM_PageLoadout_CustomData>();
			m_Harmony = new Harmony("gay.giagg.lockout3");
			m_Harmony.PatchAll(typeof(EntryPoint).Assembly);
			ClassInjector.RegisterTypeInIl2Cpp<KartKontroller>();
			ClassInjector.RegisterTypeInIl2Cpp<SentryGunTimer>();
			ClassInjector.RegisterTypeInIl2Cpp<CheckPoint>();
			ClassInjector.RegisterTypeInIl2Cpp<CustomWinScreen>();
			ClassInjector.RegisterTypeInIl2Cpp<ThrowableSentry>();
			ClassInjector.RegisterTypeInIl2Cpp<ThrowableTripmine>();
			ClassInjector.RegisterTypeInIl2Cpp<ItemPickupTrigger>();
			RegisterTypeOptions val = new RegisterTypeOptions();
			val.set_Interfaces(Il2CppInterfaceCollection.op_Implicit(new Type[1] { typeof(IDamageable) }));
			ClassInjector.RegisterTypeInIl2Cpp<KartDamage>(val);
			NetworkManager.Setup();
			AssetAPI.OnAssetBundlesLoaded += AssetAPI_OnAssetBundlesLoaded;
			Time.fixedDeltaTime = 1f / 60f;
			Physics.IgnoreLayerCollision(LayerMask.NameToLayer("ProjectileBlocker"), LayerMask.NameToLayer("ProjectileBlocker"), false);
			Physics.IgnoreLayerCollision(LayerMask.NameToLayer("ProjectileBlocker"), LayerMask.NameToLayer("Default"), false);
		}

		private void AssetAPI_OnAssetBundlesLoaded()
		{
			PrefabAPI.CreateConsumableInstance<ThrowableSentry>("Assets/GIAGG_Content/Items/Consumable_ThrowableSentry.prefab");
			PrefabAPI.CreateConsumableInstance<ThrowableTripmine>("Assets/GIAGG_Content/Items/Consumable_ThrowableMine.prefab");
			CustomWinScreen.s_Animator = ((Il2CppObjectBase)AssetShardManager.GetLoadedAsset("Assets/GIAGG_Content/Animation/Winner.controller", false)).TryCast<RuntimeAnimatorController>();
		}
	}
	[GeneratedCode("VersionInfoGenerator", "2.0.0+git50a4b1a-master")]
	[CompilerGenerated]
	internal static class VersionInfo
	{
		public const string RootNamespace = "LockoutThree";

		public const string Version = "1.0.0";

		public const string VersionPrerelease = null;

		public const string VersionMetadata = "gitbe236e6-dirty-master";

		public const string SemVer = "1.0.0+gitbe236e6-dirty-master";

		public const string GitRevShort = "be236e6-dirty";

		public const string GitRevLong = "be236e6c2f938668b824e2343278d0290e2a3096-dirty";

		public const string GitBranch = "master";

		public const string GitTag = null;

		public const bool GitIsDirty = true;
	}
}
namespace LockoutThree.Utils
{
	internal static class Il2CppFieldExtender
	{
		public unsafe static uint InjectSizedDataIntoType<TType, TSizedData>() where TSizedData : unmanaged
		{
			INativeClassStruct il2CppClass = TypeExtensions.GetIl2CppClass(typeof(TType));
			uint instanceSize = il2CppClass.InstanceSize;
			il2CppClass.ActualSize += (uint)(sizeof(TSizedData) + sizeof(IntPtr));
			il2CppClass.InstanceSize += (uint)(sizeof(TSizedData) + sizeof(IntPtr));
			return instanceSize;
		}
	}
	internal static class MathUtils
	{
		public static double FastVector3Dist(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_001b: 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_002e: 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_003d: 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)
			return Math.Sqrt((b.x - a.x) * (b.x - a.x) + (b.y - a.y) * (b.y - a.y) + (b.z - a.z) * (b.z - a.z));
		}
	}
}
namespace LockoutThree.Hooks
{
	[HarmonyPatch(typeof(CM_MenuBar))]
	internal class CM_MenuBar_Hooks
	{
		[HarmonyPatch("Setup")]
		[HarmonyPostfix]
		[HarmonyWrapSafe]
		public static void Setup_Postfix(CM_MenuBar __instance)
		{
			((CM_Item)__instance.m_loadout).SetText("Lockout 3");
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		[HarmonyWrapSafe]
		public static void Update_Postfix(CM_MenuBar __instance)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			((RectTransformComp)__instance.m_rundown).SetVisible(false);
			((RectTransformComp)__instance.m_exitLobbyAndExpedition).SetVisible(false);
			((Component)__instance.m_loadout).transform.position = ((Component)__instance.m_rundown).transform.position;
			((RectTransformComp)__instance.m_expIcon).SetVisible(false);
			((Component)__instance.m_expIcon).gameObject.SetActive(false);
			((Component)__instance.m_expText).gameObject.SetActive(false);
		}
	}
	[HarmonyPatch(typeof(CM_PageIntro))]
	internal class CM_PageIntro_Hooks
	{
		[HarmonyPatch("Setup")]
		[HarmonyPrefix]
		[HarmonyWrapSafe]
		public static void Setup_Prefix()
		{
			Global.SkipIntro = true;
			Global.RundownIdToLoad = 1000u;
		}
	}
	[HarmonyPatch(typeof(CM_PageLoadout))]
	internal class CM_PageLoadout_Hooks
	{
		private static bool ONCE_CALLED;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		[HarmonyWrapSafe]
		public static void Update_Postfix(CM_PageLoadout __instance)
		{
			//IL_0071: 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_009d: 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_011a: Expected O, but got Unknown
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Invalid comparison between Unknown and I4
			CM_PageLoadout __instance2 = __instance;
			ref CM_PageLoadout_CustomData fromObj = ref CM_PageLoadout_CustomData.GetFromObj(__instance2);
			if (!ONCE_CALLED)
			{
				GameObject obj = Object.Instantiate<GameObject>(((Component)GuiManager.Current.m_mainMenuLayer.PageRundownNew.m_pasteServerIdButton).gameObject);
				obj.transform.parent = ((Component)((CM_PageBase)__instance2).m_menuBar).transform;
				Vector3 localPosition = ((Component)((CM_PageBase)__instance2).m_menuBar.m_settings).transform.localPosition;
				localPosition.x += 150f;
				localPosition.y -= 100f;
				obj.transform.localPosition = localPosition;
				CM_Item component = obj.GetComponent<CM_Item>();
				component.OnBtnPressCallback += Action<int>.op_Implicit((Action<int>)delegate
				{
					ref CM_PageLoadout_CustomData fromObj2 = ref CM_PageLoadout_CustomData.GetFromObj(__instance2);
					if (fromObj2.HasVerified && fromObj2.VerifiedLobbyId != 0L)
					{
						CM_Utils.JoinLobby(fromObj2.VerifiedLobbyId, (Action)null, (Action)null);
						fromObj2.VerifiedLobbyId = 0uL;
					}
				});
				fromObj.CheckClipboardTimer = 0f;
				fromObj.LobbyJoinButtonPtr = ((Il2CppObjectBase)component).Pointer;
				ONCE_CALLED = true;
			}
			else
			{
				if (!(Clock.Time > fromObj.CheckClipboardTimer))
				{
					return;
				}
				fromObj.CheckClipboardTimer = Clock.Time + 1.5f;
				bool flag = false;
				CM_Item val = new CM_Item((IntPtr)fromObj.LobbyJoinButtonPtr);
				SNet_LobbyIdentifier val2 = default(SNet_LobbyIdentifier);
				if (ulong.TryParse(GUIUtility.systemCopyBuffer, out var result) && SNet.Core.IsValidLobbyID(result) && (int)SNet.Core.IsValidLobbyID_ValidateData(result, ref val2) == 2)
				{
					string text = Text.Get(11u);
					if (val2 != null)
					{
						text = val2.Name;
					}
					val.SetText(Text.Format(10u, (Object[])(object)new Object[1] { Object.op_Implicit("<color=red>" + text + "</color>") }));
					((RectTransformComp)val).SetVisible(true);
					flag = true;
					fromObj.HasVerified = true;
					fromObj.VerifiedLobbyId = result;
				}
				if (!flag)
				{
					((RectTransformComp)val).SetVisible(false);
					fromObj.VerifiedLobbyId = 0uL;
					fromObj.HasVerified = false;
				}
			}
		}
	}
	[HarmonyPatch(typeof(CM_PageRundown_New))]
	internal class CM_PageRundown_New_Hooks
	{
		[HarmonyPatch("TryPlaceRundown")]
		[HarmonyPrefix]
		[HarmonyWrapSafe]
		public static void TryPlaceRundown_Prefix(CM_PageRundown_New __instance)
		{
			__instance.m_cortexIntroIsDone = true;
		}

		[HarmonyPatch("TryPlaceRundown")]
		[HarmonyPostfix]
		[HarmonyWrapSafe]
		public static void TryPlaceRundown_Postfix()
		{
			LG_Factory.OnFactoryBuildStart += Action.op_Implicit((Action)delegate
			{
				EntryPoint.MusicPlayer.Post(3213784005u, true);
			});
		}
	}
	[HarmonyPatch(typeof(EnvironmentStateManager))]
	internal class EnvironmentStateManager_Hooks
	{
		[HarmonyPatch("AttemptStartFogTransition")]
		[HarmonyPrefix]
		[HarmonyWrapSafe]
		public static void AttemptStartFogTransition_Prefix(uint fogDataId, EnvironmentStateManager __instance)
		{
			Debug.Log(Object.op_Implicit("balls"));
			if (fogDataId == 1001)
			{
				NetworkAPI.InvokeEvent<int>("TriggerKartEntry", 0, (SNet_ChannelType)2);
				NetworkManager.SyncKartEntry(0uL, 0);
			}
		}
	}
}
namespace LockoutThree.Extensions
{
	internal static class PlayerAgentExtensions
	{
		public static void GiveItem(this PlayerAgent player, InventorySlot slot, uint itemId, float ammo = 1f, bool forceAmmo = true)
		{
			//IL_0028: 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_003e: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_0079: Invalid comparison between Unknown and I4
			//IL_0136: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected I4, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			PlayerBackpack val = PlayerBackpackManager.GetBackpack(player.Owner) ?? throw new Exception("Couldn't get backpack for " + player.PlayerName);
			pItemData val2 = default(pItemData);
			val2.itemID_gearCRC = itemId;
			val2.slot = slot;
			pItemData val3 = val2;
			val3.custom.ammo = ammo;
			val.TryClearSlot(slot);
			if (val.SpawnAndEquipItem(itemId, slot, val3) == null)
			{
				throw new Exception("Couldn't spawn and equip item for " + player.PlayerName);
			}
			if ((int)slot != 10)
			{
				InventorySlotAmmo val4 = (InventorySlotAmmo)((slot - 1) switch
				{
					0 => val.AmmoStorage.StandardAmmo, 
					1 => val.AmmoStorage.SpecialAmmo, 
					2 => val.AmmoStorage.ClassAmmo, 
					4 => val.AmmoStorage.ConsumableAmmo, 
					3 => val.AmmoStorage.ResourcePackAmmo, 
					_ => throw new Exception($"unsupported inventory slot {slot}"), 
				});
				if (forceAmmo)
				{
					val4.AmmoInPack += ammo;
				}
				else
				{
					val4.AddAmmo(ammo);
				}
			}
			player.Sync.WantsToWieldSlot(slot, false);
		}
	}
}
namespace LockoutThree.DataInjection
{
	internal struct CM_PageLoadout_CustomData
	{
		public static uint OFFSET = uint.MaxValue;

		public nint LobbyJoinButtonPtr;

		public float CheckClipboardTimer;

		public ulong VerifiedLobbyId;

		public bool HasVerified;

		public unsafe static ref CM_PageLoadout_CustomData GetFromObj(CM_PageLoadout obj)
		{
			CM_PageLoadout_CustomData* source = (CM_PageLoadout_CustomData*)((nint)((Il2CppObjectBase)obj).Pointer + OFFSET);
			return ref Unsafe.AsRef<CM_PageLoadout_CustomData>(source);
		}
	}
}