Decompiled source of BoneStrike v1.0.1

Mods/BoneStrike.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.Json.Serialization;
using BoneStrike;
using BoneStrike.Audio;
using BoneStrike.Audio.Effectors;
using BoneStrike.Config;
using BoneStrike.Manager;
using BoneStrike.Phase;
using BoneStrike.Tags;
using BoneStrike.Teams;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.Data;
using Il2CppSLZ.Marrow.Interaction;
using Il2CppSLZ.Marrow.Pool;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSystem;
using Il2CppTMPro;
using LabFusion.Data;
using LabFusion.Entities;
using LabFusion.Extensions;
using LabFusion.Marrow.Extenders;
using LabFusion.Marrow.Pool;
using LabFusion.Menu;
using LabFusion.Menu.Data;
using LabFusion.Network;
using LabFusion.Network.Serialization;
using LabFusion.Player;
using LabFusion.RPC;
using LabFusion.SDK.Gamemodes;
using LabFusion.SDK.Modules;
using LabFusion.Senders;
using LabFusion.UI.Popups;
using LabFusion.Utilities;
using MashGamemodeLibrary;
using MashGamemodeLibrary.Audio.Containers;
using MashGamemodeLibrary.Audio.Loaders;
using MashGamemodeLibrary.Audio.Modifiers;
using MashGamemodeLibrary.Audio.Music;
using MashGamemodeLibrary.Audio.Players.Background;
using MashGamemodeLibrary.Audio.Players.Background.Timed;
using MashGamemodeLibrary.Audio.Players.Basic.Providers;
using MashGamemodeLibrary.Audio.Players.Extensions;
using MashGamemodeLibrary.Audio.Players.Object;
using MashGamemodeLibrary.Audio.Registry;
using MashGamemodeLibrary.Config;
using MashGamemodeLibrary.Config.Menu;
using MashGamemodeLibrary.Config.Menu.Attributes;
using MashGamemodeLibrary.Context;
using MashGamemodeLibrary.Entities;
using MashGamemodeLibrary.Entities.Behaviour.Cache;
using MashGamemodeLibrary.Entities.CommonComponents;
using MashGamemodeLibrary.Entities.ECS;
using MashGamemodeLibrary.Entities.ECS.Attributes;
using MashGamemodeLibrary.Entities.ECS.BaseComponents;
using MashGamemodeLibrary.Entities.ECS.Declerations;
using MashGamemodeLibrary.Entities.ECS.Networking;
using MashGamemodeLibrary.Entities.Interaction;
using MashGamemodeLibrary.Entities.Interaction.Grabbing;
using MashGamemodeLibrary.Entities.Queries;
using MashGamemodeLibrary.Environment;
using MashGamemodeLibrary.Environment.Effector;
using MashGamemodeLibrary.Environment.Effector.Weather;
using MashGamemodeLibrary.Environment.State;
using MashGamemodeLibrary.Execution;
using MashGamemodeLibrary.Loadout;
using MashGamemodeLibrary.Networking.Remote;
using MashGamemodeLibrary.Phase;
using MashGamemodeLibrary.Player;
using MashGamemodeLibrary.Player.Actions;
using MashGamemodeLibrary.Player.Data;
using MashGamemodeLibrary.Player.Data.Rules;
using MashGamemodeLibrary.Player.Data.Rules.Rules;
using MashGamemodeLibrary.Player.Helpers;
using MashGamemodeLibrary.Player.Stats;
using MashGamemodeLibrary.Player.Team;
using MashGamemodeLibrary.Util.Timer;
using MashGamemodeLibrary.networking.Control;
using MashGamemodeLibrary.networking.Validation;
using MashGamemodeLibrary.networking.Variable;
using MashGamemodeLibrary.networking.Variable.Encoder;
using MashGamemodeLibrary.networking.Variable.Encoder.Impl;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Mod), "Bonestrike", "1.0.0", "Mash", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: NetworkIdentifiable("bonestrike")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("BoneStrike")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BoneStrike")]
[assembly: AssemblyTitle("BoneStrike")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace BoneStrike
{
	public class BoneStrike : ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static PlayerSpectatePredicate <>9__20_0;

			public static Func<NetworkPlayer, bool> <>9__21_1;

			public static Func<NetworkPlayer, PlayerID> <>9__21_2;

			public static ModifyRuleDelegate<PlayerCrippledRule> <>9__23_1;

			public static ModifyRuleDelegate<PlayerAmmunitionLimitRule> <>9__23_2;

			public static Runnable <>9__27_0;

			public static Func<LimitedRespawn, bool> <>9__30_1;

			public static Func<NetworkPlayer, bool> <>9__30_0;

			public static Func<LimitedRespawn, bool> <>9__31_1;

			public static Func<NetworkPlayer, bool> <>9__31_0;

			internal bool <OnRegistered>b__20_0(NetworkPlayer _)
			{
				if (AnyDefusers())
				{
					return true;
				}
				ExplodeAllBombs();
				WinManager.Win<TerroristTeam>();
				return false;
			}

			internal bool <OnStart>b__21_1(NetworkPlayer p)
			{
				return p.HasRig;
			}

			internal PlayerID <OnStart>b__21_2(NetworkPlayer p)
			{
				return p.PlayerID;
			}

			internal void <OnRoundStart>b__23_1(PlayerCrippledRule playerCrippledRule)
			{
				playerCrippledRule.IsEnabled = ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.RemoveMovementMods;
			}

			internal void <OnRoundStart>b__23_2(PlayerAmmunitionLimitRule rule)
			{
				rule.AmmunitionLimit = (ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.LimitMags ? new int?(ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.MagazineCapacity) : null);
			}

			internal void <OnPlayerLeft>b__27_0()
			{
				if (GamePhaseManager.ActivePhase is DefusePhase && !AnyDefusers())
				{
					ExplodeAllBombs();
					WinManager.Win<TerroristTeam>();
				}
			}

			internal bool <AnyDefusers>b__30_0(NetworkPlayer player)
			{
				if (player.HasRig && LogicTeamManager.IsTeam<CounterTerroristTeam>(player.PlayerID))
				{
					return PlayerComponentExtender.HasComponent<LimitedRespawn>(player, (Func<LimitedRespawn, bool>)((LimitedRespawn tag) => !tag.IsEliminated));
				}
				return false;
			}

			internal bool <AnyDefusers>b__30_1(LimitedRespawn tag)
			{
				return !tag.IsEliminated;
			}

			internal bool <AnyDefenders>b__31_0(NetworkPlayer player)
			{
				if (player.HasRig && LogicTeamManager.IsTeam<TerroristTeam>(player.PlayerID))
				{
					return PlayerComponentExtender.HasComponent<LimitedRespawn>(player, (Func<LimitedRespawn, bool>)((LimitedRespawn tag) => !tag.IsEliminated));
				}
				return false;
			}

			internal bool <AnyDefenders>b__31_1(LimitedRespawn tag)
			{
				return !tag.IsEliminated;
			}
		}

		private bool _hasAssignedTeams;

		private Vector3 _resetPoint = Vector3.zero;

		public override string Title => "Bone Strike";

		public override string Author => "Mash";

		public override string LogoResource => "BoneStrike.Resources.Icon.png";

		public override bool AutoHolsterOnDeath => true;

		public override bool DisableDevTools => ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.DevToolsDisabled;

		public override bool DisableSpawnGun => ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.DevToolsDisabled;

		public override bool DisableManualUnragdoll => true;

		public override bool SlowMotionDisabled => false;

		public override int RoundCount => 5;

		protected override void OnRegistered()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			object obj = <>c.<>9__20_0;
			if (obj == null)
			{
				PlayerSpectatePredicate val = delegate
				{
					if (AnyDefusers())
					{
						return true;
					}
					ExplodeAllBombs();
					WinManager.Win<TerroristTeam>();
					return false;
				};
				<>c.<>9__20_0 = val;
				obj = (object)val;
			}
			LimitedRespawn.RegisterSpectatePredicate<BoneStrike>((PlayerSpectatePredicate)obj);
		}

		protected override void OnStart()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			_resetPoint = RigData.RigSpawn;
			Executor.RunIfHost((Runnable)delegate
			{
				PersistentTeams.Clear();
				PersistentTeams.AddTeam<TerroristTeam>();
				PersistentTeams.AddTeam<CounterTerroristTeam>();
				if (ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.ManualTeamAssignment)
				{
					_hasAssignedTeams = false;
				}
				else
				{
					PersistentTeams.AddPlayers(from p in NetworkPlayer.Players
						where p.HasRig
						select p.PlayerID);
					PersistentTeams.RandomizeShift();
					_hasAssignedTeams = true;
				}
			}, (string)null);
		}

		protected override void OnEnd()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			Executor.RunIfHost(new Runnable(PersistentTeams.SendMessage), (string)null);
			LeaderboardManager.ShowLeaderboard(_resetPoint);
			ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Context.IntermissionMusicPlayer.Stop();
			FusionPlayer.ResetSpawnPoints();
		}

		protected override void OnRoundStart()
		{
			//IL_0006: 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_002c: Expected O, but got Unknown
			Notifier.CancelAll();
			SpawnPointHelper.SetSpawnPoint(_resetPoint);
			LogicTeamManager.Enable<TerroristTeam>();
			LogicTeamManager.Enable<CounterTerroristTeam>();
			Executor.RunIfHost((Runnable)delegate
			{
				PlayerDataManager.ModifyAll<PlayerCrippledRule>((ModifyRuleDelegate<PlayerCrippledRule>)delegate(PlayerCrippledRule playerCrippledRule)
				{
					playerCrippledRule.IsEnabled = ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.RemoveMovementMods;
				});
				PlayerDataManager.ModifyAll<PlayerAmmunitionLimitRule>((ModifyRuleDelegate<PlayerAmmunitionLimitRule>)delegate(PlayerAmmunitionLimitRule rule)
				{
					rule.AmmunitionLimit = (ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.LimitMags ? new int?(ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.MagazineCapacity) : null);
				});
				if (ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.PalletBarcodes.Count > 0)
				{
					PalletLoadoutManager.Load((IEnumerable<string>)ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.PalletBarcodes);
				}
				else
				{
					PalletLoadoutManager.Load("SLZ.BONELAB.Content");
				}
				PalletLoadoutManager.LoadUtility((IEnumerable<string>)ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.UtilityBarcodes);
				if (_hasAssignedTeams)
				{
					GamePhaseManager.Enable<PlantPhase>();
				}
				else
				{
					GamePhaseManager.Enable<TeamAssignmentPhase>();
				}
				_hasAssignedTeams = true;
			}, (string)null);
			AvatarStatManager.BalanceStats = ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.BalanceStats;
			PlayerGunManager.NormalizePlayerDamage = ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.BalanceDamage;
			ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Context.IntermissionMusicPlayer.Stop();
			ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Context.EnvironmentPlayer.StartPlaying(new EnvironmentProfile<EnvironmentContext>("all", new EnvironmentState<EnvironmentContext>[3]
			{
				(EnvironmentState<EnvironmentContext>)(object)new PlantState(),
				(EnvironmentState<EnvironmentContext>)(object)new DefuseState(),
				(EnvironmentState<EnvironmentContext>)(object)new IntermissionState()
			}, (Action)LocalWeatherManager.ClearLocalWeather));
		}

		protected override void OnRoundEnd(ulong winnerTeamId)
		{
			//IL_0014: 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_004f: Expected O, but got Unknown
			LocalPlayer.TeleportToPosition(_resetPoint);
			DelayUtilities.InvokeNextFrame((Action)delegate
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				LeaderboardManager.ShowLeaderboard(_resetPoint);
			});
			ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Context.IntermissionMusicPlayer.Start();
			Executor.RunIfHost((Runnable)delegate
			{
				PersistentTeams.AddScore(winnerTeamId, 1);
				if (winnerTeamId == LogicTeamManager.GetTeamID<CounterTerroristTeam>())
				{
					ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Context.CounterTerroristsWinAudioPlayer.PlayRandom();
				}
				else
				{
					ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Context.TerroristsWinAudioPlayer.PlayRandom();
				}
			}, (string)null);
		}

		protected override void OnCleanup()
		{
			//IL_002a: 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)
			LocalVision.Blind = false;
			LocalControls.LockedMovement = false;
			foreach (BombMarker item in BombMarker.Query)
			{
				if (item.NetworkEntity != null)
				{
					DespawnRequestInfo val = default(DespawnRequestInfo);
					val.DespawnEffect = true;
					val.EntityID = item.NetworkEntity.ID;
					NetworkAssetSpawner.Despawn(val);
				}
			}
		}

		public override void OnLateJoin(PlayerID playerID)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			PlayerID playerID2 = playerID;
			Executor.RunIfHost((Runnable)delegate
			{
				if (!(GamePhaseManager.ActivePhase is TeamAssignmentPhase))
				{
					SpectatorExtender.SetSpectating(playerID2, true);
					PersistentTeams.QueueLateJoiner(playerID2);
				}
			}, (string)null);
		}

		protected override void OnPlayerLeft(PlayerID playerId)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			object obj = <>c.<>9__27_0;
			if (obj == null)
			{
				Runnable val = delegate
				{
					if (GamePhaseManager.ActivePhase is DefusePhase && !AnyDefusers())
					{
						ExplodeAllBombs();
						WinManager.Win<TerroristTeam>();
					}
				};
				<>c.<>9__27_0 = val;
				obj = (object)val;
			}
			Executor.RunIfHost((Runnable)obj, (string)null);
		}

		public override bool CanAttackPlayer(PlayerID player)
		{
			GamePhase activePhase = GamePhaseManager.ActivePhase;
			if (activePhase != null)
			{
				if (!(activePhase is TeamAssignmentPhase))
				{
					if (!(activePhase is PlantPhase))
					{
						if (activePhase is DefusePhase defusePhase && LogicTeamManager.IsTeam<CounterTerroristTeam>(player))
						{
							return ((GamePhase)defusePhase).ElapsedTime > ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.DefuserSpawnProtection && !LogicTeamManager.IsTeamMember(player);
						}
						return !LogicTeamManager.IsTeamMember(player);
					}
					return false;
				}
				return false;
			}
			return true;
		}

		internal static void ExplodeAllBombs()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if (!ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.BombExplosion)
			{
				return;
			}
			foreach (BombMarker item in BombMarker.Query)
			{
				MarrowEntity? marrowEntity = item.MarrowEntity;
				Transform val = ((marrowEntity != null) ? ((Component)marrowEntity).transform : null);
				if (!((Object)(object)val == (Object)null))
				{
					Vector3 position = val.position;
					GameAssetSpawner.SpawnNetworkAsset("BaBaCorp.MiscExplosiveDevices.Spawnable.ExplosionSmallMedDamage", position, Array.Empty<IComponent>());
				}
			}
		}

		internal static bool AnyDefusers()
		{
			return NetworkPlayer.Players.Any((NetworkPlayer player) => player.HasRig && LogicTeamManager.IsTeam<CounterTerroristTeam>(player.PlayerID) && PlayerComponentExtender.HasComponent<LimitedRespawn>(player, (Func<LimitedRespawn, bool>)((LimitedRespawn tag) => !tag.IsEliminated)));
		}

		internal static bool AnyDefenders()
		{
			return NetworkPlayer.Players.Any((NetworkPlayer player) => player.HasRig && LogicTeamManager.IsTeam<TerroristTeam>(player.PlayerID) && PlayerComponentExtender.HasComponent<LimitedRespawn>(player, (Func<LimitedRespawn, bool>)((LimitedRespawn tag) => !tag.IsEliminated)));
		}
	}
	public class BoneStrikeContext : GameModeContext<BoneStrikeContext>
	{
		private static readonly AudioBin ClockAudioBin = AudioRegistry.CreateBin("MashTags.SFX.Bonestrike.BombBeep", new string[1] { "Mash.BoneStrike.MonoDisc.ClockBeep" });

		private static readonly AudioBin KillAudioBin = AudioRegistry.CreateBin("MashTags.SFX.Bonestrike.Kill", new string[1] { "Mash.BoneStrike.MonoDisc.Kill" });

		private static readonly AudioBin PlantPhaseStartAudioBin = AudioRegistry.CreateBin("MashTags.SFX.Bonestrike.PlantPhaseStart", new string[1] { "Mash.BoneStrike.MonoDisc.PlantPhaseStart" });

		private static readonly AudioBin DefusePhaseStartAudioBin = AudioRegistry.CreateBin("MashTags.SFX.Bonestrike.DefusePhaseStart", new string[1] { "Mash.BoneStrike.MonoDisc.DefusePhaseStart" });

		private static readonly AudioBin TerroristsWinAudioBin = AudioRegistry.CreateBin("MashTags.SFX.Bonestrike.TerroristsWin", new string[1] { "Mash.BoneStrike.MonoDisc.TerroristsWin" });

		private static readonly AudioBin CounterTerroristsWinAudioBin = AudioRegistry.CreateBin("MashTags.SFX.Bonestrike.CounterTerroristsWin", new string[1] { "Mash.BoneStrike.MonoDisc.CounterTerroristsWin" });

		public readonly TimedComponentPlayer<BombMarker> BombAudioPlayer = new TimedComponentPlayer<BombMarker>((IRandomAudioPlayer<NetworkEntity>)new ObjectAudioPlayer("BombSound", (ISyncedAudioContainer)new DesyncedAudioContainer((IAudioContainer)new LoadOnDemandContainer((IAudioLoader)new AudioBinLoader(ClockAudioBin))), 1, new AudioModifierFactory().AddModifier<AudioSettingsModifier>((ModifierDelegate<AudioSettingsModifier>)((AudioSettingsModifier settings) => settings.SetVolume(1f).SetMaxDistance(200f)))), 5f, (float?)6f);

		public readonly PositionalAudioPlayer KillAudioPlayer = new PositionalAudioPlayer("KillSound", (ISyncedAudioContainer)new DesyncedAudioContainer((IAudioContainer)new LoadOnDemandContainer((IAudioLoader)new AudioBinLoader(KillAudioBin))), (AudioSourceProvider)new PooledAudioSourceProvider(5, new AudioModifierFactory().AddModifier<AudioSettingsModifier>((ModifierDelegate<AudioSettingsModifier>)((AudioSettingsModifier settings) => settings.SetVolume(1f).SetMaxDistance(800f).SetSpatialBlend(0.45f)
			.SetCustomRolloff(AnimationCurve.Constant(0f, 1f, 1f))))));

		public readonly AnnouncementAudioPlayer PlantPhaseStartAudioPlayer = new AnnouncementAudioPlayer("PlantPhaseStart", (ISyncedAudioContainer)new DesyncedAudioContainer((IAudioContainer)new LoadOnDemandContainer((IAudioLoader)new AudioBinLoader(PlantPhaseStartAudioBin))), (AudioModifierFactory)null);

		public readonly AnnouncementAudioPlayer DefusePhaseStartAudioPlayer = new AnnouncementAudioPlayer("DefusePhaseStart", (ISyncedAudioContainer)new DesyncedAudioContainer((IAudioContainer)new LoadOnDemandContainer((IAudioLoader)new AudioBinLoader(DefusePhaseStartAudioBin))), (AudioModifierFactory)null);

		public readonly AnnouncementAudioPlayer TerroristsWinAudioPlayer = new AnnouncementAudioPlayer("TerroristsWin", (ISyncedAudioContainer)new DesyncedAudioContainer((IAudioContainer)new LoadOnDemandContainer((IAudioLoader)new AudioBinLoader(TerroristsWinAudioBin))), (AudioModifierFactory)null);

		public readonly AnnouncementAudioPlayer CounterTerroristsWinAudioPlayer = new AnnouncementAudioPlayer("CounterTerroristsWin", (ISyncedAudioContainer)new DesyncedAudioContainer((IAudioContainer)new LoadOnDemandContainer((IAudioLoader)new AudioBinLoader(CounterTerroristsWinAudioBin))), (AudioModifierFactory)null);

		public readonly EnvironmentManager<BoneStrikeContext, EnvironmentContext> EnvironmentPlayer = new EnvironmentManager<BoneStrikeContext, EnvironmentContext>((Func<BoneStrikeContext, EnvironmentContext>)EnvironmentContext.GetContext);

		public readonly MusicPlayer IntermissionMusicPlayer = new MusicPlayer((IAudioContainer)new LoadOnDemandContainer((IAudioLoader)new MusicPackLoader((MusicPackTags)2)));
	}
	public class FusionModule : Module
	{
		public override string Name => "BoneStrike";

		protected override void OnModuleRegistered()
		{
			GamemodeRegistration.RegisterGamemode<BoneStrike>();
		}
	}
	public class Mod : MelonMod
	{
		public override void OnInitializeMelon()
		{
			if (MelonBase.FindMelon("LabFusion", "Lakatrazz") != null)
			{
				ModuleManager.RegisterModule<FusionModule>();
				Mod.Register<Mod>();
			}
		}
	}
}
namespace BoneStrike.Teams
{
	public class CounterTerroristTeam : LogicTeam
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<LimitedRespawn> <>9__5_2;

			public static Runnable <>9__7_0;

			internal LimitedRespawn <OnPhaseChanged>b__5_2()
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				return new LimitedRespawn(0);
			}

			internal void <OnRemoved>b__7_0()
			{
				LocalControls.LockedMovement = false;
			}
		}

		public override string Name => "LavaGang";

		public override Texture Icon { get; } = MenuResources.GetLogoIcon("LavaGang");


		public override void OnPhaseChanged(GamePhase phase)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			GamePhase phase2 = phase;
			Executor.RunIfHost((Runnable)delegate
			{
				PlayerComponentExtender.ToggleComponent<LimitedRespawn>(((LogicTeam)this).Owner, phase2 is DefusePhase, (Func<LimitedRespawn>)(() => new LimitedRespawn(0)));
			}, (string)null);
			Executor.RunIfMe(((LogicTeam)this).Owner.PlayerID, (Runnable)delegate
			{
				LocalControls.LockedMovement = phase2 is PlantPhase;
				LocalVision.Blind = phase2 is PlantPhase && ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.BlindAttackersDuringPlanting;
			});
		}

		protected override void OnAssigned()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			PlayerComponentExtender.AddComponent(((LogicTeam)this).Owner, (IComponent)(object)new KillEffect());
			Executor.RunIfMe(((LogicTeam)this).Owner.PlayerID, (Runnable)delegate
			{
				//IL_0012: 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_006f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Expected O, but got Unknown
				PlayerComponentExtender.AddComponent(((LogicTeam)this).Owner, (IComponent)(object)new PlayerHandTimerTag());
				AvatarStats val = default(AvatarStats);
				val.Agility = 1.2f;
				val.LowerStrength = 1.2f;
				val.UpperStrength = 1.2f;
				val.Speed = ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.MovementSpeedMultiplier;
				val.Vitality = 1f;
				AvatarStatManager.SetStats(((AvatarStats)(ref val)).MultiplyHealth(ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.AttackerHealthMultiplier));
				Notifier.Send(new Notification
				{
					Title = NotificationText.op_Implicit("LavaGang"),
					Message = NotificationText.op_Implicit("Stop Sabrelake from ending the simulation by disabling the alarm!"),
					PopupLength = 10f,
					SaveToMenu = false,
					ShowPopup = true,
					Type = (NotificationType)0
				});
			});
		}

		protected override void OnRemoved()
		{
			//IL_001f: 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_002a: Expected O, but got Unknown
			PlayerID playerID = ((LogicTeam)this).Owner.PlayerID;
			object obj = <>c.<>9__7_0;
			if (obj == null)
			{
				Runnable val = delegate
				{
					LocalControls.LockedMovement = false;
				};
				<>c.<>9__7_0 = val;
				obj = (object)val;
			}
			Executor.RunIfMe(playerID, (Runnable)obj);
		}
	}
	public class TerroristTeam : LogicTeam
	{
		public override string Name => "Sabrelake";

		public override Texture Icon { get; } = MenuResources.GetLogoIcon("Sabrelake");


		public override void OnPhaseChanged(GamePhase phase)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			GamePhase phase2 = phase;
			Executor.RunIfHost((Runnable)delegate
			{
				PlayerComponentExtender.ToggleComponent<LimitedRespawn>(((LogicTeam)this).Owner, phase2 is DefusePhase, (Func<LimitedRespawn>)(() => new LimitedRespawn(0)));
			}, (string)null);
		}

		protected override void OnAssigned()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			PlayerComponentExtender.AddComponent(((LogicTeam)this).Owner, (IComponent)(object)new KillEffect());
			Executor.RunIfMe(((LogicTeam)this).Owner.PlayerID, (Runnable)delegate
			{
				//IL_0012: 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_006f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Expected O, but got Unknown
				PlayerComponentExtender.AddComponent(((LogicTeam)this).Owner, (IComponent)(object)new PlayerHandTimerTag());
				AvatarStats val = default(AvatarStats);
				val.Agility = 1.2f;
				val.LowerStrength = 1.2f;
				val.UpperStrength = 1.2f;
				val.Speed = ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.MovementSpeedMultiplier;
				val.Vitality = 1f;
				AvatarStatManager.SetStats(((AvatarStats)(ref val)).MultiplyHealth(ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.DefenderHealthMultiplier));
				Notifier.Send(new Notification
				{
					Title = NotificationText.op_Implicit("Sabrelake"),
					Message = NotificationText.op_Implicit("Hide and defend the alarm clock and purge the simulation."),
					PopupLength = 10f,
					SaveToMenu = false,
					ShowPopup = true,
					Type = (NotificationType)0
				});
			});
		}
	}
}
namespace BoneStrike.Tags
{
	public class BombMarker : IComponent, IEntityAttached, IBehaviour, IRemoved, IPhaseChanged, IUpdate, IGrabCallback, IDropCallback
	{
		public static readonly CachedQuery<BombMarker> Query = CachedQueryManager.Create<BombMarker>();

		private const float MaxVelocitySquared = 400f;

		public NetworkEntity? NetworkEntity;

		public MarrowEntity? MarrowEntity;

		private Vector3? _returnPosition;

		private List<Rigidbody>? _rigidbodies;

		private bool _isGrabbed;

		public void OnReady(NetworkEntity networkEntity, MarrowEntity marrowEntity)
		{
			NetworkEntity = networkEntity;
			MarrowEntity = marrowEntity;
			_rigidbodies = ((IEnumerable<MarrowBody>)MarrowEntity._bodies).Select((MarrowBody b) => b._rigidbody).ToList();
		}

		public void OnPhaseChange(GamePhase gamePhase)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)MarrowEntity == (Object)null) && gamePhase is DefusePhase)
			{
				_returnPosition = ((Component)MarrowEntity).transform.position;
			}
		}

		public void OnRemoved()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			Executor.RunIfHost(new Runnable(WinManager.Win<CounterTerroristTeam>), (string)null);
		}

		public void Update(float delta)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)MarrowEntity == (Object)null || _rigidbodies == null)
			{
				return;
			}
			if (_isGrabbed)
			{
				_returnPosition = ((Component)MarrowEntity).transform.position;
			}
			else if (!(_rigidbodies.Average(delegate(Rigidbody r)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				Vector3 velocity = r.velocity;
				return ((Vector3)(ref velocity)).sqrMagnitude;
			}) < 400f))
			{
				_rigidbodies.ForEach(delegate(Rigidbody r)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					r.velocity = Vector3.zero;
				});
				if (_returnPosition.HasValue)
				{
					((Component)MarrowEntity).transform.position = _returnPosition.Value;
				}
			}
		}

		public void OnGrabbed(GrabRequest grabRequest)
		{
			_isGrabbed = true;
		}

		public void OnDropped(GrabRequest grabRequest)
		{
			_isGrabbed = false;
		}
	}
	public class DefusableTag : IEntityAttached, IBehaviour, IComponent, IGrabPredicate, IRemoved, IUpdate, IGrabCallback, IDropCallback, INetworkEvents, INetSerializable
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Runnable <>9__10_0;

			internal void <OnGrabbed>b__10_0()
			{
				LocalControls.LockedMovement = true;
			}
		}

		private static readonly RemoteEvent DefuseEvent = new RemoteEvent("DefuseEvent", new EventHandler(OnDefuse), CommonNetworkRoutes.AllToHost);

		private const int SyncTimeEventIndex = 0;

		private PlayerID? _grabber;

		private Transform? _offset;

		private TextMeshPro? _text;

		private Poolee? _timerObject;

		private TextMeshPro? _clockText;

		private bool _isDefused;

		private float _timer;

		public void OnDropped(GrabRequest grabRequest)
		{
			_grabber = null;
			Poolee? timerObject = _timerObject;
			if (timerObject != null)
			{
				((Component)timerObject).gameObject.SetActive(false);
			}
			if (GamePhaseManager.IsPhase<DefusePhase>())
			{
				LocalControls.LockedMovement = false;
			}
			if (grabRequest.NetworkPlayer.PlayerID.IsMe)
			{
				NetworkEventsExtender.SendEvent((INetworkEvents)(object)this, (byte)0, 4, (Action<NetWriter>)delegate(NetWriter writer)
				{
					writer.Write(_timer);
				});
			}
		}

		public void OnGrabbed(GrabRequest grabRequest)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			if (GamePhaseManager.IsPhase<PlantPhase>() || !LogicTeamManager.IsTeam<CounterTerroristTeam>(grabRequest.NetworkPlayer.PlayerID))
			{
				return;
			}
			PlayerID playerID = grabRequest.NetworkPlayer.PlayerID;
			object obj = <>c.<>9__10_0;
			if (obj == null)
			{
				Runnable val = delegate
				{
					LocalControls.LockedMovement = true;
				};
				<>c.<>9__10_0 = val;
				obj = (object)val;
			}
			Executor.RunIfMe(playerID, (Runnable)obj);
			_grabber = grabRequest.NetworkPlayer.PlayerID;
			Poolee? timerObject = _timerObject;
			if (timerObject != null)
			{
				((Component)timerObject).gameObject.SetActive(true);
			}
			if (grabRequest.NetworkPlayer.PlayerID.IsMe)
			{
				NetworkEventsExtender.SendEvent((INetworkEvents)(object)this, (byte)0, 4, (Action<NetWriter>)delegate(NetWriter writer)
				{
					writer.Write(_timer);
				});
			}
		}

		public bool CanGrab(GrabRequest grabRequest)
		{
			if (GamePhaseManager.IsPhase<PlantPhase>())
			{
				return LogicTeamManager.IsLocalTeam<TerroristTeam>();
			}
			return LogicTeamManager.IsLocalTeam<CounterTerroristTeam>();
		}

		public void Serialize(INetSerializer serializer)
		{
			serializer.SerializeValue(ref _timer);
		}

		public void OnReady(NetworkEntity networkEntity, MarrowEntity marrowEntity)
		{
			SpawnTimer(((Component)marrowEntity).transform);
			_clockText = ((Component)marrowEntity).GetComponentInChildren<TextMeshPro>();
		}

		public void OnRemoved()
		{
			Poolee? timerObject = _timerObject;
			if (timerObject != null)
			{
				timerObject.Despawn();
			}
		}

		public void Update(float delta)
		{
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: 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)
			GamePhase activePhase = GamePhaseManager.ActivePhase;
			if (activePhase != null && (Object)(object)_clockText != (Object)null)
			{
				float num = activePhase.Duration - activePhase.ElapsedTime;
				int value = Math.Max(Mathf.FloorToInt(num / 60f), 0);
				int value2 = Math.Max(Mathf.FloorToInt(num % 60f), 0);
				((TMP_Text)_clockText).text = $"{value:D2}:{value2:D2}";
			}
			if (_grabber == null || GamePhaseManager.IsPhase<PlantPhase>())
			{
				return;
			}
			_timer += delta;
			float defuseTime = ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.DefuseTime;
			if (defuseTime - _timer <= 0f && !_isDefused)
			{
				Defuse();
				return;
			}
			if ((Object)(object)_offset != (Object)null && (Object)(object)_timerObject != (Object)null)
			{
				_offset.position = ((Component)_timerObject).transform.position + new Vector3(0f, 0.2f, 0f);
			}
			if (!((Object)(object)_text == (Object)null))
			{
				((TMP_Text)_text).text = (defuseTime - _timer).ToString("F1", CultureInfo.InvariantCulture);
			}
		}

		private void Defuse()
		{
			if (_grabber != null && _grabber.IsMe && !_isDefused)
			{
				_isDefused = true;
				if (NetworkInfo.IsHost)
				{
					WinManager.Win<CounterTerroristTeam>();
				}
				else
				{
					MelonLogger.Msg("Sent defuse request.");
					DefuseEvent.CallFor(PlayerIDManager.GetHostID());
				}
				_grabber = null;
			}
		}

		private void SpawnTimer(Transform parent)
		{
			//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)
			Transform parent2 = parent;
			if (!Object.op_Implicit((Object)(object)_timerObject))
			{
				Spawnable obj = LocalAssetSpawner.CreateSpawnable("Mash.BoneStrike.Spawnable.Timer");
				LocalAssetSpawner.Register(obj);
				LocalAssetSpawner.Spawn(obj, Vector3.zero, Quaternion.identity, (Action<Poolee>)delegate(Poolee poolee)
				{
					//IL_0061: Unknown result type (might be due to invalid IL or missing references)
					//IL_0066: Unknown result type (might be due to invalid IL or missing references)
					((Component)poolee).gameObject.SetActive(false);
					_timerObject = poolee;
					_offset = ((Component)_timerObject).transform.GetChild(0);
					_text = ((Component)poolee).GetComponentInChildren<TextMeshPro>();
					((Component)poolee).transform.parent = parent2;
					((Component)poolee).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
				});
			}
		}

		public void OnEvent(byte senderId, byte eventIndex, NetReader reader)
		{
			if (eventIndex == 0 && PlayerID.op_Implicit(PlayerIDManager.LocalID) != senderId)
			{
				_timer = reader.ReadSingle();
			}
		}

		private static void OnDefuse(byte senderId)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			if (!GamePhaseManager.IsPhase<PlantPhase>() && PlayerIDManager.SmallIDLookup.TryGetValue(senderId, out var value) && value.IsValid)
			{
				if (!LogicTeamManager.IsTeam<CounterTerroristTeam>(value))
				{
					MelonLogger.Warning($"Player {value} attempted to defuse but is not on the Counter-Terrorist team.");
				}
				Executor.RunIfHost(new Runnable(WinManager.Win<CounterTerroristTeam>), (string)null);
			}
		}
	}
	[LocalOnly]
	public class KillEffect : IComponent, IPlayerAttached, IPlayerBehaviour, IBehaviour, IPlayerActionCallback
	{
		private NetworkPlayer? _owner;

		public void OnReady(NetworkPlayer networkPlayer)
		{
			_owner = networkPlayer;
		}

		public void OnAction(PlayerActionType action, PlayerID otherPlayer)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			Executor.RunIfHost((Runnable)delegate
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Invalid comparison between Unknown and I4
				//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_0050: Unknown result type (might be due to invalid IL or missing references)
				if (_owner != null && (int)action == 3 && _owner.HasRig)
				{
					Vector3 position = _owner.RigRefs.Head.position;
					ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Context.KillAudioPlayer.PlayRandom(position);
				}
			}, (string)null);
		}
	}
	public class OvertimeMarker : IComponent, IEntityAttached, IBehaviour, IRemoved, IUpdate
	{
		private const string MarkerBarcode = "Mash.BoneStrike.Spawnable.BombMarker";

		private const float BlinkTime = 1f;

		private const float BlinkInterval = 0.5f;

		private MarrowEntity? _marrowEntity;

		private Poolee? _poolee;

		private MeshRenderer? _renderer;

		private bool _isVisible;

		private float _timer;

		public void OnReady(NetworkEntity networkEntity, MarrowEntity marrowEntity)
		{
			//IL_0017: 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)
			_marrowEntity = marrowEntity;
			Spawnable obj = LocalAssetSpawner.CreateSpawnable("Mash.BoneStrike.Spawnable.BombMarker");
			LocalAssetSpawner.Register(obj);
			LocalAssetSpawner.Spawn(obj, Vector3.zero, Quaternion.identity, (Action<Poolee>)delegate(Poolee poolee)
			{
				_poolee = poolee;
				_renderer = ((Component)poolee).GetComponentInChildren<MeshRenderer>();
				if ((Object)(object)_renderer != (Object)null)
				{
					((Renderer)_renderer).enabled = false;
				}
			});
		}

		public void OnRemoved()
		{
			if (!((Object)(object)_poolee == (Object)null))
			{
				_poolee.Despawn();
				_poolee = null;
				_renderer = null;
			}
		}

		public void Update(float delta)
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_marrowEntity == (Object)null) && !((Object)(object)_poolee == (Object)null) && !((Object)(object)_renderer == (Object)null))
			{
				_timer += delta;
				float num = (_isVisible ? 0.5f : 1f);
				if (!(_timer < num))
				{
					_timer = 0f;
					_isVisible = !_isVisible;
					((Renderer)_renderer).enabled = _isVisible;
					((Component)_poolee).transform.position = ((Component)_marrowEntity).transform.position;
				}
			}
		}
	}
	[LocalOnly]
	public class PlayerHandTimerTag : IPlayerAttached, IPlayerBehaviour, IBehaviour, IUpdate, IComponent, IRemoved
	{
		public static readonly CachedQuery<PlayerHandTimerTag> Query = CachedQueryManager.Create<PlayerHandTimerTag>();

		private Transform? _compasPointer;

		private bool _isSpawning;

		private NetworkPlayer _owner;

		private Func<IEnumerable<Vector3>>? _getTargetTransform;

		private TextMeshPro? _text;

		private Poolee? _timerObject;

		public void SetTarget(Func<IEnumerable<Vector3>> getter)
		{
			_getTargetTransform = getter;
		}

		public void OnReady(NetworkPlayer networkPlayer)
		{
			_owner = networkPlayer;
			SpawnTimer();
		}

		public void OnRemoved()
		{
			Poolee? timerObject = _timerObject;
			if (timerObject != null)
			{
				timerObject.Despawn();
			}
			_timerObject = null;
		}

		public void Update(float delta)
		{
			//IL_0077: 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_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_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_0095: 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_00a4: 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_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_00c2: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: 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_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: 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_01b7: 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_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_timerObject == (Object)null)
			{
				return;
			}
			GamePhase activePhase = GamePhaseManager.ActivePhase;
			if ((!_owner.PlayerID.IsMe && SpectatorExtender.IsSpectating(_owner)) || activePhase == null)
			{
				((Component)_timerObject).gameObject.SetActive(false);
				return;
			}
			((Component)_timerObject).gameObject.SetActive(true);
			Transform transform = ((Component)_owner.RigRefs.LeftHand).transform;
			Vector3 position2 = transform.position;
			Vector3 position = position2 + transform.forward * 0.05f + transform.right * -0.05f;
			Quaternion rotation = transform.rotation;
			((Component)_timerObject).transform.SetPositionAndRotation(position, rotation);
			if ((Object)(object)_compasPointer != (Object)null)
			{
				Vector3? val = _getTargetTransform?.Invoke().DefaultIfEmpty().MinBy(delegate(Vector3 t)
				{
					//IL_0000: Unknown result type (might be due to invalid IL or missing references)
					//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)
					Vector3 val3 = t - position;
					return ((Vector3)(ref val3)).sqrMagnitude;
				});
				((Component)_compasPointer).gameObject.SetActive(val.HasValue);
				if (val.HasValue)
				{
					Vector3 val2 = val.Value - position;
					val2 = Vector3.ProjectOnPlane(((Vector3)(ref val2)).normalized, Vector3.up);
					Vector3 normalized = ((Vector3)(ref val2)).normalized;
					float num = Mathf.Atan2(normalized.x, normalized.z) * 57.29578f;
					Vector3 right = transform.right;
					val2 = Vector3.ProjectOnPlane((-right + transform.up) * 2.5f, Vector3.up);
					Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
					float num2 = Mathf.Atan2(normalized2.x, normalized2.z) * 57.29578f;
					float num3 = (((-right).y > 0f) ? 180f : 0f);
					float num4 = 0f - num + num2 + num3;
					_compasPointer.localEulerAngles = new Vector3(num4, 0f, 0f);
				}
			}
			if (!((Object)(object)_text == (Object)null))
			{
				float num5 = activePhase.Duration - activePhase.ElapsedTime;
				int value = Math.Max(Mathf.FloorToInt(num5 / 60f), 0);
				int value2 = Math.Max(Mathf.FloorToInt(num5 % 60f), 0);
				((TMP_Text)_text).text = $"{value:D2}:{value2:D2}";
			}
		}

		private void SpawnTimer()
		{
			//IL_002e: 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)
			if (!((Object)(object)_timerObject != (Object)null) && !_isSpawning)
			{
				_isSpawning = true;
				Spawnable obj = LocalAssetSpawner.CreateSpawnable("Mash.BoneStrike.Spawnable.HandTimer");
				LocalAssetSpawner.Register(obj);
				LocalAssetSpawner.Spawn(obj, Vector3.zero, Quaternion.identity, (Action<Poolee>)delegate(Poolee poolee)
				{
					_timerObject = poolee;
					_text = ((Component)poolee).GetComponentInChildren<TextMeshPro>();
					_compasPointer = ((Component)poolee).transform.FindChild("Compas");
					_isSpawning = false;
				});
			}
		}
	}
}
namespace BoneStrike.Phase
{
	public class DefusePhase : GamePhase
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Action<float> <>9__5_0;

			public static Func<BombMarker, bool> <>9__7_2;

			public static Func<BombMarker, Vector3> <>9__7_3;

			public static Func<IEnumerable<Vector3>> <>9__7_1;

			public static ModifyRuleDelegate<HideEnemyNametagsRule> <>9__7_4;

			public static Runnable <>9__7_0;

			internal void <get_Markers>b__5_0(float _)
			{
				if (!ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.MarkBombNearEnd)
				{
					return;
				}
				foreach (BombMarker item in BombMarker.Query)
				{
					NetworkEntity? networkEntity = item.NetworkEntity;
					if (networkEntity != null)
					{
						NetworkEntityExtender.AddComponent(networkEntity, (IComponent)(object)new OvertimeMarker());
					}
				}
			}

			internal IEnumerable<Vector3> <OnPhaseEnter>b__7_1()
			{
				return from p in (IEnumerable<BombMarker>)BombMarker.Query
					where (Object)(object)p.MarrowEntity != (Object)null
					select ((Component)p.MarrowEntity).transform.position;
			}

			internal bool <OnPhaseEnter>b__7_2(BombMarker p)
			{
				return (Object)(object)p.MarrowEntity != (Object)null;
			}

			internal Vector3 <OnPhaseEnter>b__7_3(BombMarker p)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return ((Component)p.MarrowEntity).transform.position;
			}

			internal void <OnPhaseEnter>b__7_0()
			{
				ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Context.BombAudioPlayer.Start();
				ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Context.DefusePhaseStartAudioPlayer.PlayRandom();
				PlayerDataManager.ModifyAll<HideEnemyNametagsRule>((ModifyRuleDelegate<HideEnemyNametagsRule>)delegate(HideEnemyNametagsRule rule)
				{
					rule.IsEnabled = true;
				});
			}

			internal void <OnPhaseEnter>b__7_4(HideEnemyNametagsRule rule)
			{
				rule.IsEnabled = true;
			}
		}

		public override string Name => "Defuse Phase";

		public override float Duration => ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.DefuseDuration;

		protected override TimeMarker[] Markers => (TimeMarker[])(object)new TimeMarker[3]
		{
			CommonTimeMarkerEvents.TimeRemaining(10f),
			new TimeMarker((MarkerType)1, 30f, (Action<float>)delegate
			{
				if (!ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.MarkBombNearEnd)
				{
					return;
				}
				foreach (BombMarker item in BombMarker.Query)
				{
					NetworkEntity? networkEntity = item.NetworkEntity;
					if (networkEntity != null)
					{
						NetworkEntityExtender.AddComponent(networkEntity, (IComponent)(object)new OvertimeMarker());
					}
				}
			}),
			CommonTimeMarkerEvents.TimeRemaining(60f)
		};

		public override PhaseIdentifier GetNextPhase()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (!((GamePhase)this).HasReachedDuration())
			{
				return PhaseIdentifier.Empty();
			}
			BoneStrike.ExplodeAllBombs();
			WinManager.Win<TerroristTeam>();
			return PhaseIdentifier.Empty();
		}

		protected override void OnPhaseEnter()
		{
			//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_000b: 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)
			//IL_0029: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			Notifier.Send(new Notification
			{
				Title = NotificationText.op_Implicit("Game Start!"),
				Message = NotificationText.op_Implicit(LogicTeamManager.IsLocalTeam<TerroristTeam>() ? "Defend the bomb!" : "Defuse the bomb!"),
				ShowPopup = true,
				SaveToMenu = false,
				PopupLength = 4f,
				Type = (NotificationType)0
			});
			Executor.RunCheckedInFuture<Action>((Action)DropClock, TimeSpan.FromSeconds(5.0));
			foreach (PlayerHandTimerTag item in PlayerHandTimerTag.Query)
			{
				item.SetTarget(() => from p in (IEnumerable<BombMarker>)BombMarker.Query
					where (Object)(object)p.MarrowEntity != (Object)null
					select ((Component)p.MarrowEntity).transform.position);
			}
			object obj = <>c.<>9__7_0;
			if (obj == null)
			{
				Runnable val = delegate
				{
					ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Context.BombAudioPlayer.Start();
					ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Context.DefusePhaseStartAudioPlayer.PlayRandom();
					PlayerDataManager.ModifyAll<HideEnemyNametagsRule>((ModifyRuleDelegate<HideEnemyNametagsRule>)delegate(HideEnemyNametagsRule rule)
					{
						rule.IsEnabled = true;
					});
				};
				<>c.<>9__7_0 = val;
				obj = (object)val;
			}
			Executor.RunIfHost((Runnable)obj, (string)null);
		}

		private static void DropClock()
		{
			if (!LogicTeamManager.IsLocalTeam<TerroristTeam>() || !RigData.HasPlayer)
			{
				return;
			}
			foreach (Hand item in MarrowInventoryExtender.GetHandsHoldingTag<BombMarker>(RigData.Refs))
			{
				HandExtensions.TryDetach(item);
			}
		}
	}
	internal class FetchClockPacket : INetSerializable, IKnownSenderPacket
	{
		public Handedness Hand;

		public byte SenderSmallId { get; set; }

		public void Serialize(INetSerializer serializer)
		{
			serializer.SerializeValue<Handedness>(ref Hand);
		}
	}
	public class PlantPhase : GamePhase
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Runnable <>9__10_0;

			internal void <OnPhaseEnter>b__10_0()
			{
				//IL_002e: 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_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Expected O, but got Unknown
				PhaseShouldQuit.Value = false;
				PersistentTeams.AssignAll();
				PalletLoadoutManager.AssignAll();
				Vector3 position = ((Component)((GameModeContext<BoneStrikeContext>)(object)ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Context).LocalPlayer.RigRefs.RightHand).transform.position;
				GameAssetSpawner.SpawnNetworkAsset(ClockBarcode, position, (IComponent[])(object)new IComponent[3]
				{
					new BombMarker(),
					new DefusableTag(),
					(IComponent)new ImportantEntityMarker()
				});
				ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Context.PlantPhaseStartAudioPlayer.PlayRandom();
			}
		}

		private static readonly string ClockBarcode = "SLZ.BONELAB.Content.Spawnable.AlarmClock";

		private static readonly SyncedVariable<bool> PhaseShouldQuit = new SyncedVariable<bool>("SkipPlantPhase", (IEncoder<bool>)new BoolEncoder(), false, CommonNetworkRoutes.AllToAll);

		private static readonly RemoteEvent<FetchClockPacket> FetchClockEvent = new RemoteEvent<FetchClockPacket>("FetchClockEvent", (PacketHandler<FetchClockPacket>)OnFetchClock, CommonNetworkRoutes.AllToHost);

		public override string Name => "Plant Phase";

		public override float Duration => ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.PlantDuration;

		protected override TimeMarker[] Markers => (TimeMarker[])(object)new TimeMarker[2]
		{
			CommonTimeMarkerEvents.TimeRemaining(10f),
			CommonTimeMarkerEvents.TimeRemaining(60f)
		};

		public override PhaseIdentifier GetNextPhase()
		{
			//IL_0014: 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)
			if (((GamePhase)this).HasReachedDuration() || PhaseShouldQuit.Value)
			{
				return PhaseIdentifier.Of<DefusePhase>();
			}
			return PhaseIdentifier.Empty();
		}

		protected override void OnPhaseEnter()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			LocalInventory.SetAmmo(2000);
			PlayerGrabManager.GrabPredicate = new GrabPredicateHanlder(GrabPredicate);
			object obj = <>c.<>9__10_0;
			if (obj == null)
			{
				Runnable val = delegate
				{
					//IL_002e: 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_0052: Unknown result type (might be due to invalid IL or missing references)
					//IL_0058: Expected O, but got Unknown
					PhaseShouldQuit.Value = false;
					PersistentTeams.AssignAll();
					PalletLoadoutManager.AssignAll();
					Vector3 position = ((Component)((GameModeContext<BoneStrikeContext>)(object)ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Context).LocalPlayer.RigRefs.RightHand).transform.position;
					GameAssetSpawner.SpawnNetworkAsset(ClockBarcode, position, (IComponent[])(object)new IComponent[3]
					{
						new BombMarker(),
						new DefusableTag(),
						(IComponent)new ImportantEntityMarker()
					});
					ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Context.PlantPhaseStartAudioPlayer.PlayRandom();
				};
				<>c.<>9__10_0 = val;
				obj = (object)val;
			}
			Executor.RunIfHost((Runnable)obj, (string)null);
		}

		protected override void OnPhaseExit()
		{
			PlayerGrabManager.GrabPredicate = null;
		}

		public override void OnPlayerAction(PlayerID playerId, PlayerGameActions action, Handedness handedness)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_0028: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			NetworkPlayer val = default(NetworkPlayer);
			if (playerId.IsMe && (int)action == 6 && LogicTeamManager.IsTeam<TerroristTeam>(playerId) && NetworkPlayerManager.TryGetPlayer(PlayerID.op_Implicit(playerId), ref val))
			{
				if (MarrowInventoryExtender.IsHolding<BombMarker>(val, handedness))
				{
					PhaseShouldQuit.Value = true;
					return;
				}
				FetchClockEvent.Call(new FetchClockPacket
				{
					Hand = handedness
				});
			}
		}

		private bool GrabPredicate(GrabRequest request)
		{
			NetworkEntity grabbedNetworkEntity = request.GrabbedNetworkEntity;
			if (grabbedNetworkEntity == null)
			{
				return true;
			}
			NetworkPlayer extender = grabbedNetworkEntity.GetExtender<NetworkPlayer>();
			if (extender != null && !LogicTeamManager.IsTeamMember(extender.PlayerID))
			{
				return false;
			}
			Transform parent = ((Component)request.GrabbedEntity).transform.parent;
			if ((Object)(object)parent == (Object)null)
			{
				return true;
			}
			InventorySlotReceiver component = ((Component)parent).GetComponent<InventorySlotReceiver>();
			if ((Object)(object)component == (Object)null)
			{
				return true;
			}
			NetworkEntity val = default(NetworkEntity);
			if (!InventorySlotReceiverExtender.Cache.TryGet(component, ref val))
			{
				return true;
			}
			if (!val.HasOwner)
			{
				return true;
			}
			if (LogicTeamManager.IsTeamMember(val.OwnerID))
			{
				return true;
			}
			return false;
		}

		private static void OnFetchClock(FetchClockPacket packet)
		{
			//IL_0020: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			NetworkPlayer val = default(NetworkPlayer);
			if (!NetworkPlayerManager.TryGetPlayer(packet.SenderSmallId, ref val) || !val.HasRig)
			{
				return;
			}
			Hand hand = val.RigRefs.GetHand(packet.Hand);
			if (hand.HasAttachedObject())
			{
				return;
			}
			Vector3 position = hand.palmPositionTransform.position;
			InteractableHost val2 = default(InteractableHost);
			foreach (BombMarker item in BombMarker.Query)
			{
				NetworkEntity networkEntity = item.NetworkEntity;
				if (networkEntity == null)
				{
					continue;
				}
				NetworkProp extender = networkEntity.GetExtender<NetworkProp>();
				if (extender != null)
				{
					MarrowEntity marrowEntity = extender.MarrowEntity;
					if (!((Object)(object)marrowEntity == (Object)null) && (!InteractableHost.Cache.TryGet(((Component)marrowEntity).gameObject, ref val2) || !val2.IsAttached))
					{
						NetworkEntityManager.TakeOwnership(networkEntity);
						networkEntity.LockOwner();
						marrowEntity.EnableColliders(false);
						marrowEntity._anchorBody._rigidbody.velocity = Vector3.zero;
						marrowEntity.Teleport(position, Quaternion.identity, true);
						marrowEntity.EnableColliders(true);
						networkEntity.UnlockOwner();
					}
				}
			}
		}
	}
	public record SpawnTeamWallPacket : INetSerializable
	{
		public Vector3 Position;

		public float Yaw;

		public void Serialize(INetSerializer serializer)
		{
			NetSerializerUnityExtensions.SerializeValue(serializer, ref Position);
			serializer.SerializeValue(ref Yaw);
		}

		[CompilerGenerated]
		protected virtual bool PrintMembers(StringBuilder builder)
		{
			RuntimeHelpers.EnsureSufficientExecutionStack();
			builder.Append("Position = ");
			builder.Append(((object)(Vector3)(ref Position)).ToString());
			builder.Append(", Yaw = ");
			builder.Append(Yaw.ToString());
			return true;
		}
	}
	internal record struct PlayerWallSide(PlayerID PlayerID, bool IsInFront);
	public class TeamAssignmentPhase : GamePhase
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<NetworkPlayer, bool> <>9__12_0;

			public static Func<PlayerWallSide, bool> <>9__14_0;

			public static Runnable <>9__16_0;

			public static Action<Poolee> <>9__19_0;

			internal bool <GetPlayerWallSides>b__12_0(NetworkPlayer player)
			{
				return player.HasRig;
			}

			internal bool <AreTeamsFair>b__14_0(PlayerWallSide p)
			{
				return p.IsInFront;
			}

			internal void <OnPhaseEnter>b__16_0()
			{
				//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_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				NetworkPlayer networkPlayer = LocalPlayer.GetNetworkPlayer();
				Transform val = ((networkPlayer != null) ? networkPlayer.RigRefs.Head : null);
				if (!((Object)(object)val == (Object)null))
				{
					Quaternion rotation = val.rotation;
					float y = ((Quaternion)(ref rotation)).eulerAngles.y;
					SpawnTeamWallEvent.Call(new SpawnTeamWallPacket
					{
						Position = val.position,
						Yaw = y
					});
				}
			}

			internal void <SpawnTeamWall>b__19_0(Poolee poolee)
			{
				_poolee = poolee;
				_timerTexts = Il2CppArrayBase<TextMeshPro>.op_Implicit(((Component)poolee).GetComponentsInChildren<TextMeshPro>());
			}
		}

		private static readonly RemoteEvent<SpawnTeamWallPacket> SpawnTeamWallEvent = new RemoteEvent<SpawnTeamWallPacket>((PacketHandler<SpawnTeamWallPacket>)SpawnTeamWallHandler, CommonNetworkRoutes.HostToAll);

		private static readonly string TeamWallBarcode = "Mash.BoneStrike.Spawnable.TeamWALL";

		private static Poolee? _poolee;

		private static TextMeshPro[] _timerTexts = (TextMeshPro[])(object)new TextMeshPro[2];

		private static Vector3 _wallPosition;

		private static Quaternion _wallRotation;

		private static bool _areTeamsFair;

		public override string Name => "Team Assignment Phase";

		public override float Duration => 15f;

		private bool IsPositionInFrontOfWall(Vector3 position)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0015: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = position - _wallPosition;
			Vector3 val2 = _wallRotation * Vector3.forward;
			return Vector3.Dot(val, val2) > 0f;
		}

		private IEnumerable<PlayerWallSide> GetPlayerWallSides()
		{
			return from player in NetworkPlayer.Players
				where player.HasRig
				select new PlayerWallSide(player.PlayerID, IsPositionInFrontOfWall(player.RigRefs.Head.position));
		}

		public override PhaseIdentifier GetNextPhase()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (!((GamePhase)this).HasReachedDuration())
			{
				return PhaseIdentifier.Empty();
			}
			return PhaseIdentifier.Of<PlantPhase>();
		}

		private bool AreTeamsFair()
		{
			List<PlayerWallSide> list = GetPlayerWallSides().ToList();
			int num = list.Count((PlayerWallSide p) => p.IsInFront);
			int num2 = list.Count - num;
			if (num == 0 || num2 == 0)
			{
				return false;
			}
			if (ExtendedGamemode<BoneStrikeContext, BoneStrikeConfig>.Config.AllowUnbalancedTeams)
			{
				return true;
			}
			int num3 = (((num + num2) % 2 != 0) ? 1 : 0);
			if (Mathf.Abs(num - num2) > num3)
			{
				return false;
			}
			return true;
		}

		public override bool CanTimerTick()
		{
			_areTeamsFair = AreTeamsFair();
			return _areTeamsFair;
		}

		protected override void OnPhaseEnter()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			object obj = <>c.<>9__16_0;
			if (obj == null)
			{
				Runnable val = delegate
				{
					//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_002a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0041: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: Unknown result type (might be due to invalid IL or missing references)
					NetworkPlayer networkPlayer = LocalPlayer.GetNetworkPlayer();
					Transform val2 = ((networkPlayer != null) ? networkPlayer.RigRefs.Head : null);
					if (!((Object)(object)val2 == (Object)null))
					{
						Quaternion rotation = val2.rotation;
						float y = ((Quaternion)(ref rotation)).eulerAngles.y;
						SpawnTeamWallEvent.Call(new SpawnTeamWallPacket
						{
							Position = val2.position,
							Yaw = y
						});
					}
				};
				<>c.<>9__16_0 = val;
				obj = (object)val;
			}
			Executor.RunIfHost((Runnable)obj, (string)null);
		}

		protected override void OnPhaseExit()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			Executor.RunIfHost((Runnable)delegate
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				List<PlayerID>[] array = new List<PlayerID>[2]
				{
					new List<PlayerID>(),
					new List<PlayerID>()
				};
				foreach (NetworkPlayer player in NetworkPlayer.Players)
				{
					if (player.HasRig)
					{
						int num = ((!IsPositionInFrontOfWall(player.RigRefs.Head.position)) ? 1 : 0);
						array[num].Add(player.PlayerID);
					}
				}
				PersistentTeams.OverwritePlayers((IEnumerable<IEnumerable<PlayerID>>)array);
			}, (string)null);
			if (!((Object)(object)_poolee == (Object)null))
			{
				_poolee.Despawn();
				_poolee = null;
			}
		}

		protected override void OnUpdate()
		{
			//IL_00c0: 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)
			if ((Object)(object)_poolee == (Object)null)
			{
				return;
			}
			TextMeshPro[] timerTexts;
			if (!_areTeamsFair)
			{
				timerTexts = _timerTexts;
				foreach (TextMeshPro obj in timerTexts)
				{
					((Graphic)obj).color = Color.red;
					((TMP_Text)obj).text = "X";
				}
				return;
			}
			float num = ((GamePhase)this).Duration - ((GamePhase)this).ElapsedTime;
			int value = Math.Max(Mathf.FloorToInt(num / 60f), 0);
			int value2 = Math.Max(Mathf.FloorToInt(num % 60f), 0);
			string text = $"{value:D1}:{value2:D2}";
			timerTexts = _timerTexts;
			foreach (TextMeshPro obj2 in timerTexts)
			{
				((Graphic)obj2).color = Color.white;
				((TMP_Text)obj2).text = text;
			}
		}

		private static void SpawnTeamWall(Vector3 position, Quaternion rotation)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			_wallPosition = position;
			_wallRotation = rotation;
			if ((Object)(object)_poolee != (Object)null)
			{
				Transform transform = ((Component)_poolee).transform;
				transform.position = position;
				transform.rotation = rotation;
				return;
			}
			Spawnable obj = LocalAssetSpawner.CreateSpawnable(TeamWallBarcode);
			LocalAssetSpawner.Register(obj);
			LocalAssetSpawner.Spawn(obj, position, rotation, (Action<Poolee>)delegate(Poolee poolee)
			{
				_poolee = poolee;
				_timerTexts = Il2CppArrayBase<TextMeshPro>.op_Implicit(((Component)poolee).GetComponentsInChildren<TextMeshPro>());
			});
		}

		private static void SpawnTeamWallHandler(SpawnTeamWallPacket packet)
		{
			//IL_0010: 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)
			//IL_0017: 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)
			Quaternion rotation = Quaternion.Euler(0f, packet.Yaw, 0f);
			SpawnTeamWall(packet.Position, rotation);
		}
	}
}
namespace BoneStrike.Manager
{
	internal class LeaderboardPlayerEntry
	{
		public GameObject Root;

		public Image Background;

		public TextMeshPro PositionText;

		public TextMeshPro NameText;

		public TextMeshPro KillsText;

		public TextMeshPro DeathsText;

		public TextMeshPro AssistsText;

		public TextMeshPro WinsText;

		public TextMeshPro ScoreText;

		public LeaderboardPlayerEntry(GameObject root)
		{
			Transform transform = root.transform;
			Root = ((Component)transform.Find("Content")).gameObject;
			Background = Root.GetComponent<Image>();
			PositionText = ((Component)root.transform.Find("Content/Position")).GetComponent<TextMeshPro>();
			NameText = ((Component)root.transform.Find("Content/Player")).GetComponent<TextMeshPro>();
			KillsText = ((Component)root.transform.Find("Content/Stats/Kills")).GetComponent<TextMeshPro>();
			DeathsText = ((Component)root.transform.Find("Content/Stats/Deaths")).GetComponent<TextMeshPro>();
			AssistsText = ((Component)root.transform.Find("Content/Stats/Assists")).GetComponent<TextMeshPro>();
			WinsText = ((Component)root.transform.Find("Content/Stats/Wins")).GetComponent<TextMeshPro>();
			ScoreText = ((Component)root.transform.Find("Content/Stats/Score")).GetComponent<TextMeshPro>();
		}
	}
	internal class LeaderboardPlayerData
	{
		public PlayerID PlayerId { get; init; }

		public int Kills { get; init; }

		public int Deaths { get; init; }

		public int Assists { get; init; }

		public int Wins { get; init; }

		public int Score { get; init; }

		public LeaderboardPlayerData(PlayerStatistics statistics)
		{
			PlayerId = PlayerIDManager.GetPlayerID(statistics.PlayerID);
			Kills = statistics.GetValue((Enum)(object)(PlayerDamageStatistics)0);
			Deaths = statistics.GetValue((Enum)(object)(PlayerDamageStatistics)2);
			Assists = statistics.GetValue((Enum)(object)(PlayerDamageStatistics)1);
			Wins = statistics.GetValue((Enum)(object)(TeamStatisticKeys)0);
			Score = (Kills + Assists / 2 + Wins * 2 - Deaths) * 125;
		}
	}
	public static class LeaderboardManager
	{
		private const string Barcode = "Mash.BoneStrike.Spawnable.Leaderboard";

		private static Poolee? _poolee;

		private static readonly List<LeaderboardPlayerEntry> Entries = new List<LeaderboardPlayerEntry>();

		private static void Spawn(Vector3 position)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_poolee != (Object)null)
			{
				SetContent();
				((Component)_poolee).gameObject.SetActive(true);
				return;
			}
			GameAssetSpawner.SpawnLocalAsset("Mash.BoneStrike.Spawnable.Leaderboard", position, (Action<Poolee>)delegate(Poolee poolee)
			{
				_poolee = poolee;
				LoadEntries();
				SetContent();
			});
		}

		private static void SetEntryData(LeaderboardPlayerEntry entry, LeaderboardPlayerData data, int position)
		{
			//IL_010a: 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)
			((TMP_Text)entry.PositionText).text = position.ToString();
			string valueOrEmpty = data.PlayerId.Metadata.Nickname.GetValueOrEmpty();
			string text = (string.IsNullOrEmpty(valueOrEmpty) ? data.PlayerId.Metadata.Username.GetValueOrEmpty() : valueOrEmpty);
			((TMP_Text)entry.NameText).text = text;
			((TMP_Text)entry.KillsText).text = data.Kills.ToString();
			((TMP_Text)entry.DeathsText).text = data.Deaths.ToString();
			((TMP_Text)entry.AssistsText).text = data.Assists.ToString();
			((TMP_Text)entry.WinsText).text = data.Wins.ToString();
			((TMP_Text)entry.ScoreText).text = data.Score.ToString();
			((Graphic)entry.Background).color = ((PersistentTeams.GetTeamIndex(data.PlayerId) == 0) ? new Color(1f, 0.2f, 0.2f) : new Color(0.2f, 0.2f, 1f));
		}

		public static void SetContent()
		{
			if ((Object)(object)_poolee == (Object)null)
			{
				return;
			}
			List<LeaderboardPlayerData> list = (from v in GlobalStatisticsCollector.Statistics
				select new LeaderboardPlayerData(v) into v
				where v.PlayerId.IsValid
				select v).ToList();
			list.Sort((LeaderboardPlayerData a, LeaderboardPlayerData b) => b.Score.CompareTo(a.Score));
			bool flag = false;
			for (int i = 0; i < Entries.Count - 1; i++)
			{
				LeaderboardPlayerEntry leaderboardPlayerEntry = Entries[i + 1];
				bool flag2 = i < list.Count;
				leaderboardPlayerEntry.Root.SetActive(flag2);
				if (flag2)
				{
					LeaderboardPlayerData data = list[i];
					SetEntryData(leaderboardPlayerEntry, data, i + 1);
				}
			}
			if (!flag)
			{
				int num = list.FindIndex((LeaderboardPlayerData s) => s.PlayerId.IsMe);
				if (num != -1)
				{
					LeaderboardPlayerData data2 = list[num];
					SetEntryData(Entries[num + 1], data2, num + 1);
				}
			}
		}

		private static void LoadEntries()
		{
			if ((Object)(object)_poolee == (Object)null)
			{
				return;
			}
			Entries.Clear();
			Transform val = ((Component)_poolee).transform.Find("Center/Players");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError(Object.op_Implicit("Failed to find player list in leaderboard"));
				return;
			}
			for (int i = 0; i < val.childCount; i++)
			{
				Transform child = val.GetChild(i);
				if (!((Object)(object)child == (Object)null))
				{
					Entries.Add(new LeaderboardPlayerEntry(((Component)child).gameObject));
				}
			}
		}

		public static void ShowLeaderboard(Vector3 position)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			Spawn(position);
		}

		public static void HideLeaderboard()
		{
			if (!((Object)(object)_poolee == (Object)null))
			{
				((Component)_poolee).gameObject.SetActive(false);
			}
		}
	}
}
namespace BoneStrike.Config
{
	internal class SecondsToMinutesElementProvider : IConfigElementProvider
	{
		public ElementData GetElementData(ConfigEntryData entry, Action<ConfigEntryData, object> setter)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0040: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			Action<ConfigEntryData, object> setter2 = setter;
			ConfigEntryData entry2 = entry;
			return (ElementData)new FloatElementData
			{
				Title = entry2.Name,
				Increment = 0.25f,
				MaxValue = 10f,
				MinValue = 0.25f,
				Value = Convert.ToSingle(entry2.Value) / 60f,
				OnValueChanged = delegate(float f)
				{
					setter2(entry2, Convert.ToSingle(f) * 60f);
				}
			};
		}
	}
	internal class PositionElementProvider : IConfigElementProvider
	{
		public ElementData GetElementData(ConfigEntryData entry, Action<ConfigEntryData, object> setter)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			Action<ConfigEntryData, object> setter2 = setter;
			ConfigEntryData entry2 = entry;
			return (ElementData)new FunctionElementData
			{
				Title = entry2.Name,
				OnPressed = delegate
				{
					//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)
					NetworkPlayer networkPlayer = LocalPlayer.GetNetworkPlayer();
					if (networkPlayer != null && networkPlayer.HasRig)
					{
						Vector3 position = ((Component)networkPlayer.RigRefs.RigManager).transform.position;
						setter2(entry2, position);
					}
				}
			};
		}
	}
	internal class CrateBarcodeElement : IConfigElementProvider
	{
		public ElementData GetElementData(ConfigEntryData entry, Action<ConfigEntryData, object> setter)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			Action<ConfigEntryData, object> setter2 = setter;
			ConfigEntryData entry2 = entry;
			return (ElementData)new SpawnableElementData
			{
				Title = entry2.Name,
				OnSetSpawnable = delegate(Barcode barcode)
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_0012: Expected O, but got Unknown
					Crate val = default(Crate);
					if (AssetWarehouse.Instance.TryGetCrate(new Barcode(barcode), ref val))
					{
						setter2(entry2, ((Scannable)val._pallet)._barcode._id);
					}
				}
			};
		}
	}
	internal class CrateBarcodeListElement : IConfigElementProvider
	{
		public ElementData GetElementData(ConfigEntryData entry, Action<ConfigEntryData, object> setter)
		{
			//IL_001f: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_006a: 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_0079: Expected O, but got Unknown
			ConfigEntryData entry2 = entry;
			Action<ConfigEntryData, object> setter2 = setter;
			GroupElementData val = new GroupElementData(entry2.Name);
			SpawnableElementData val2 = new SpawnableElementData
			{
				Title = "Add Held Item Pallet",
				OnSetSpawnable = delegate(Barcode barcode)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: Expected O, but got Unknown
					Barcode val4 = new Barcode(barcode);
					Crate val5 = default(Crate);
					if (AssetWarehouse.Instance.TryGetCrate(val4, ref val5))
					{
						List<string> list = (List<string>)entry2.Value;
						string id = ((Scannable)val5._pallet)._barcode._id;
						if (!list.Contains(id))
						{
							list.Add(id);
							setter2(entry2, list);
						}
					}
				}
			};
			FunctionElementData val3 = new FunctionElementData
			{
				Title = "Clear",
				OnPressed = delegate
				{
					setter2(entry2, new List<string>());
				}
			};
			val.AddElement<SpawnableElementData>(val2);
			val.AddElement<FunctionElementData>(val3);
			return (ElementData)val;
		}
	}
	internal class BarcodeListElement : IConfigElementProvider
	{
		public ElementData GetElementData(ConfigEntryData entry, Action<ConfigEntryData, object> setter)
		{
			//IL_001f: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_006a: 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_0079: Expected O, but got Unknown
			ConfigEntryData entry2 = entry;
			Action<ConfigEntryData, object> setter2 = setter;
			GroupElementData val = new GroupElementData(entry2.Name);
			SpawnableElementData val2 = new SpawnableElementData
			{
				Title = "Add Held Item",
				OnSetSpawnable = delegate(Barcode barcode)
				{
					List<string> list = (List<string>)entry2.Value;
					string id = barcode._id;
					if (!list.Contains(id))
					{
						list.Add(id);
						setter2(entry2, list);
					}
				}
			};
			FunctionElementData val3 = new FunctionElementData
			{
				Title = "Clear",
				OnPressed = delegate
				{
					setter2(entry2, new List<string>());
				}
			};
			val.AddElement<SpawnableElementData>(val2);
			val.AddElement<FunctionElementData>(val3);
			return (ElementData)val;
		}
	}
	public class BoneStrikeConfig : IConfig, INetSerializable, ICloneable
	{
		[ConfigMenuEntry("Plant Phase Duration", "Time")]
		[ConfigElementProvider(typeof(SecondsToMinutesElementProvider))]
		[JsonInclude]
		public float PlantDuration = 90f;

		[ConfigMenuEntry("Defuse Phase Duration", "Time")]
		[ConfigElementProvider(typeof(SecondsToMinutesElementProvider))]
		[JsonInclude]
		public float DefuseDuration = 150f;

		[ConfigMenuEntry("Defuse timer", "Time")]
		[ConfigRangeConstraint(2f, 20f)]
		[JsonInclude]
		public float DefuseTime = 7f;

		[ConfigMenuEntry("Mark Bomb in last 30 seconds", "Time")]
		[JsonInclude]
		public bool MarkBombNearEnd = true;

		[ConfigMenuEntry("Balance Weapon Damage (EXPERIMENTAL)", "Balancing")]
		[JsonInclude]
		public bool BalanceDamage;

		[ConfigMenuEntry("Balance Avatar Health", "Balancing")]
		[JsonInclude]
		public bool BalanceStats = true;

		[ConfigMenuEntry("Defuser Spawn Protection", "Balancing")]
		[ConfigRangeConstraint(0f, 15f)]
		[ConfigStepSize(1f)]
		[JsonInclude]
		public float DefuserSpawnProtection = 5f;

		[ConfigMenuEntry("Limit Player Magazines", "Balancing")]
		[JsonInclude]
		public bool LimitMags = true;

		[ConfigMenuEntry("Max ammunition", "Balancing")]
		[ConfigRangeConstraint(50, 300)]
		[ConfigStepSize(50)]
		[JsonInclude]
		public int MagazineCapacity = 150;

		[ConfigMenuEntry("Movement Speed", "Balancing")]
		[ConfigRangeConstraint(1f, 2f)]
		[ConfigStepSize(0.05f)]
		[JsonInclude]
		public float MovementSpeedMultiplier = 1.35f;

		[ConfigMenuEntry("Blind Attackers During Planting", "Health")]
		[JsonInclude]
		public bool BlindAttackersDuringPlanting;

		[ConfigMenuEntry("Defender Health Multiplier", "Health")]
		[ConfigRangeConstraint(0.25f, 4f)]
		[ConfigStepSize(0.25f)]
		[JsonInclude]
		public float DefenderHealthMultiplier = 1f;

		[ConfigMenuEntry("Attacker Health Multiplier", "Health")]
		[ConfigRangeConstraint(0.25f, 4f)]
		[ConfigStepSize(0.25f)]
		[JsonInclude]
		public float AttackerHealthMultiplier = 1.5f;

		[ConfigMenuEntry("Weapons", null)]
		[ConfigElementProvider(typeof(CrateBarcodeListElement))]
		[JsonInclude]
		public List<string> PalletBarcodes = new List<string>();

		[ConfigMenuEntry("Uility Items", null)]
		[ConfigElementProvider(typeof(BarcodeListElement))]
		[JsonInclude]
		public List<string> UtilityBarcodes = new List<string>();

		[ConfigMenuEntry("Bomb Explosion Enabled", "Utility")]
		[JsonInclude]
		public bool BombExplosion = true;

		[ConfigMenuEntry("Dev Tools Disabled", "Utility")]
		[JsonInclude]
		public bool DevToolsDisabled = true;

		[ConfigMenuEntry("Mitigate Movement Mods", "Utility")]
		[JsonInclude]
		public bool RemoveMovementMods = true;

		[ConfigMenuEntry("Manual Team Assignment", "Teams")]
		[JsonInclude]
		public bool ManualTeamAssignment = true;

		[ConfigMenuEntry("Allow Unbalanced Teams", "Teams")]
		[JsonInclude]
		public bool AllowUnbalancedTeams;

		public void Serialize(INetSerializer serializer)
		{
			serializer.SerializeValue(ref PlantDuration);
			serializer.SerializeValue(ref DefuseDuration);
			serializer.SerializeValue(ref DefuseTime);
			serializer.SerializeValue(ref BlindAttackersDuringPlanting);
			serializer.SerializeValue(ref DefenderHealthMultiplier);
			serializer.SerializeValue(ref AttackerHealthMultiplier);
			serializer.SerializeValue(ref LimitMags);
			serializer.SerializeValue(ref MagazineCapacity);
			serializer.SerializeValue(ref BalanceStats);
			serializer.SerializeValue(ref BalanceDamage);
			serializer.SerializeValue(ref DefuserSpawnProtection);
			serializer.SerializeValue(ref MovementSpeedMultiplier);
			serializer.SerializeValue(ref DevToolsDisabled);
			serializer.SerializeValue(ref ManualTeamAssignment);
			serializer.SerializeValue(ref AllowUnbalancedTeams);
			serializer.SerializeValue(ref MarkBombNearEnd);
			serializer.SerializeValue(ref RemoveMovementMods);
		}

		public object Clone()
		{
			return new BoneStrikeConfig
			{
				PlantDuration = PlantDuration,
				DefuseDuration = DefuseDuration,
				DefuseTime = DefuseTime,
				BlindAttackersDuringPlanting = BlindAttackersDuringPlanting,
				BalanceStats = BalanceStats,
				BalanceDamage = BalanceDamage,
				DefuserSpawnProtection = DefuserSpawnProtection,
				MovementSpeedMultiplier = MovementSpeedMultiplier,
				DefenderHealthMultiplier = DefenderHealthMultiplier,
				AttackerHealthMultiplier = AttackerHealthMultiplier,
				LimitMags = LimitMags,
				MagazineCapacity = MagazineCapacity,
				PalletBarcodes = new List<string>(PalletBarcodes),
				UtilityBarcodes = new List<string>(UtilityBarcodes),
				BombExplosion = BombExplosion,
				DevToolsDisabled = DevToolsDisabled,
				ManualTeamAssignment = ManualTeamAssignment,
				AllowUnbalancedTeams = AllowUnbalancedTeams,
				MarkBombNearEnd = MarkBombNearEnd,
				RemoveMovementMods = RemoveMovementMods
			};
		}
	}
}
namespace BoneStrike.Audio
{
	public class DefuseState : EnvironmentState<EnvironmentContext>
	{
		public override int Priority => 5;

		public DefuseState()
			: base(new EnvironmentEffector<EnvironmentContext>[1] { (EnvironmentEffector<EnvironmentContext>)(object)new DefuseMusicEffector() })
		{
		}

		public override bool CanPlay(EnvironmentContext context)
		{
			return GamePhaseManager.IsPhase<DefusePhase>();
		}
	}
	public class EnvironmentContext
	{
		public static EnvironmentContext GetContext(BoneStrikeContext context)
		{
			return new EnvironmentContext();
		}
	}
	public class IntermissionState : EnvironmentState<EnvironmentContext>
	{
		public override int Priority => 15;

		public IntermissionState()
			: base(new EnvironmentEffector<EnvironmentContext>[1] { (EnvironmentEffector<EnvironmentContext>)(object)new IntermissionMusicEffector() })
		{
		}

		public override bool CanPlay(EnvironmentContext context)
		{
			return GamePhaseManager.IsPhase<TeamAssignmentPhase>();
		}
	}
	public class PlantState : EnvironmentState<EnvironmentContext>
	{
		public override int Priority => 10;

		public PlantState()
			: base(new EnvironmentEffector<EnvironmentContext>[1] { (EnvironmentEffector<EnvironmentContext>)(object)new PlantMusicEffector() })
		{
		}

		public override bool CanPlay(EnvironmentContext context)
		{
			return GamePhaseManager.IsPhase<PlantPhase>();
		}
	}
}
namespace BoneStrike.Audio.Effectors
{
	public class DefuseMusicEffector : AudioEffector<EnvironmentContext>
	{
		public override Enum Track => EffectorTrack.Music;

		public DefuseMusicEffector()
			: base((IContinuousPlayer)new MusicPlayer((IAudioContainer)new LoadOnDemandContainer((IAudioLoader)new MusicPackLoader((MusicPackTags)0))))
		{
		}//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Expected O, but got Unknown

	}
	public enum EffectorTrack
	{
		Music
	}
	public class IntermissionMusicEffector : AudioEffector<EnvironmentContext>
	{
		public override Enum Track => EffectorTrack.Music;

		public IntermissionMusicEffector()
			: base((IContinuousPlayer)new MusicPlayer((IAudioContainer)new LoadOnDemandContainer((IAudioLoader)new MusicPackLoader((MusicPackTags)2))))
		{
		}//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Expected O, but got Unknown

	}
	public class PlantMusicEffector : AudioEffector<EnvironmentContext>
	{
		public override Enum Track => EffectorTrack.Music;

		public PlantMusicEffector()
			: base((IContinuousPlayer)new MusicPlayer((IAudioContainer)new LoadOnDemandContainer((IAudioLoader)new MusicPackLoader((MusicPackTags)1))))
		{
		}//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Expected O, but got Unknown

	}
}