Decompiled source of LazerWeaponEdited v1.1.3

PotatoesStolenMods-LazerWeaponEdit.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using ConfigSync;
using ContentSettings.API;
using ContentSettings.API.Settings;
using HarmonyLib;
using LazerWeaponry.Hooks;
using LazerWeaponry.Settings;
using Microsoft.CodeAnalysis;
using MortalEnemies;
using MyceliumNetworking;
using On;
using Photon.Pun;
using Steamworks;
using TMPro;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Localization.PropertyVariants;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Zorro.Core;
using Zorro.Core.CLI;
using Zorro.Settings;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Ashley.MeshSplitter")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("com.rlabrecque.steamworks.net")]
[assembly: IgnoresAccessChecksTo("Discord")]
[assembly: IgnoresAccessChecksTo("HBAO.Demo.Universal.Runtime")]
[assembly: IgnoresAccessChecksTo("HBAO.Runtime")]
[assembly: IgnoresAccessChecksTo("HBAO.Universal.Runtime")]
[assembly: IgnoresAccessChecksTo("MeshSplit")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("pworld")]
[assembly: IgnoresAccessChecksTo("sc.posteffects.runtime")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.Unity.Addressables")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.UnityLocalization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Tayx.Graphy")]
[assembly: IgnoresAccessChecksTo("Unity.Addressables")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InternalAPIEngineBridge.013")]
[assembly: IgnoresAccessChecksTo("Unity.Localization")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.PlayableGraphVisualizer")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipeline.Universal.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Universal.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Universal.Shaders")]
[assembly: IgnoresAccessChecksTo("Unity.ResourceManager")]
[assembly: IgnoresAccessChecksTo("Unity.ScriptableBuildPipeline")]
[assembly: IgnoresAccessChecksTo("Unity.Splines")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("Zorro.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Zorro.PhotonUtility")]
[assembly: IgnoresAccessChecksTo("Zorro.Recorder")]
[assembly: IgnoresAccessChecksTo("Zorro.Settings.Runtime")]
[assembly: IgnoresAccessChecksTo("Zorro.UI.Runtime")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("cyclozarin.contentwarning.LazerWeaponry")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-dev+3584ab5957279ff498de1174b1cd99bc92852a3d")]
[assembly: AssemblyProduct("LazerWeaponry")]
[assembly: AssemblyTitle("cyclozarin.contentwarning.LazerWeaponry")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public static class MyPluginInfoNew
{
	public const string PLUGIN_GUID = "Potatoe.LazerWeaponryEdited";

	public const string PLUGIN_NAME = "LazerWeaponryEdited";

	public const string PLUGIN_VERSION = "1.0.1";
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace LazerWeaponry
{
	[HarmonyPatch(typeof(RoomStatsHolder))]
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Potatoe.LazerWeaponryEdited", "LazerWeaponryEdited", "1.0.1")]
	[ContentWarningPlugin("Potatoe.LazerWeaponryEdited", "1.0.1", false)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class LazerWeaponryPlugin : BaseUnityPlugin
	{
		internal static class InitialSettings
		{
			internal static float HeadshotSoundVolume = 0.75f;

			internal static float KillSoundVolume = 1f;

			internal static int Damage => 10;

			internal static int MaxAmmo => 10;

			internal static float DelayAfterFire => 0.05f;

			internal static float HeadshotDamageMultiplier => 2f;

			internal static bool PVPMode => true;

			internal static float MonsterFallTime => 2f;

			internal static float MonsterHitForceMultiplier => 0.25f;

			internal static int RecoilForce => 15;

			internal static int PlayerKillReward => 160;

			internal static int MonsterKillReward => 35;

			internal static bool VulnerableEnemies => true;

			internal static float HeadshotFallTime => 2.5f;
		}

		internal static class SyncedSettings
		{
			internal static Configuration sync_PVPMode = new Configuration("LazerWeaponryPlugin", "LW_PvPMode", (object)false);

			internal static Configuration sync_Damage = new Configuration("LazerWeaponryPlugin", "LW_Damage", (object)10);

			internal static Configuration sync_MaxAmmo = new Configuration("LazerWeaponryPlugin", "LW_MaxAmmo", (object)10);

			internal static Configuration sync_DelayAfterFire = new Configuration("LazerWeaponryPlugin", "LW_DelayAfterFire", (object)0.1f);

			internal static Configuration sync_HeadshotDamageMultiplier = new Configuration("LazerWeaponryPlugin", "LW_HeadshotDamageMultiplier", (object)2f);

			internal static Configuration sync_MonsterFallTime = new Configuration("LazerWeaponryPlugin", "LW_MonsterFallTime", (object)2f);

			internal static Configuration sync_MonsterHitForceMultiplier = new Configuration("LazerWeaponryPlugin", "LW_MonsterHitForceMultiplier", (object)0.25f);

			internal static Configuration sync_RecoilForce = new Configuration("LazerWeaponryPlugin", "LW_RecoilForce", (object)25);

			internal static Configuration sync_PlayerKillReward = new Configuration("LazerWeaponryPlugin", "LW_PlayerKillReward", (object)35);

			internal static Configuration sync_MonsterKillReward = new Configuration("LazerWeaponryPlugin", "LW_MonsterKillReward", (object)15);

			internal static Configuration sync_HeadshotFallTime = new Configuration("LazerWeaponryPlugin", "LW_HeadshotFallTime", (object)1.5f);

			internal static Configuration sync_VulnerableEnemies = new Configuration("LazerWeaponryPlugin", "LW_VulnerableEnemies", (object)false);
		}

		private enum SoundType
		{
			Headshot,
			Kill
		}

		internal static GameObject Projectile = null;

		internal const uint MYCELIUM_ID = 3913099u;

		internal AssetBundle Bundle = null;

		internal AudioClip HeadshotSound = null;

		internal AudioClip KillSound = null;

		internal static Dictionary<string, int> MapNameToDiveBellCount = new Dictionary<string, int>
		{
			{ "FactoryScene", 20 },
			{ "HarbourScene", 8 },
			{ "MinesScene", 7 }
		};

		private static Item _rescueHookItem = null;

		private int _totalRewardForAllKills;

		public static LazerWeaponryPlugin Instance { get; private set; } = null;


		internal static ManualLogSource Logger { get; private set; } = null;


		internal static int LocalPhotonViewID => Player.localPlayer.refs.view.ViewID;

		internal static bool IsOnSurface
		{
			get
			{
				//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)
				Scene activeScene = SceneManager.GetActiveScene();
				return ((Scene)(ref activeScene)).name.Contains("Surface");
			}
		}

		internal static bool MortalityLoaded => Chainloader.PluginInfos.ContainsKey("rivinwin.MortalEnemies");

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			if (!MortalityLoaded)
			{
				Logger.LogWarning((object)"MortalEnemies is not loaded. Vulnerable enemies setting won't work.");
			}
			HookAll();
			RegisterSettings();
			RegisterSyncedSettings();
			MyceliumNetwork.RegisterNetworkObject((object)this, 3913099u, 0);
			MyceliumNetwork.RegisterLobbyDataKey("diveBellArrivingMessage");
			MyceliumNetwork.RegisterLobbyDataKey("diveBellIndexes");
			Logger.LogInfo((object)("LazerWeaponryEdited by " + "Potatoe.LazerWeaponryEdited".Split(".")[0] + " has loaded!"));
		}

		private void Start()
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			Logger.LogInfo((object)"Assigning all important stuff...");
			Projectile = Resources.Load<GameObject>("Dog").GetComponentInChildren<Attack_Dog>().projectile;
			Bundle = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("LazerWeaponry.Bundles.sfxbundle"));
			HeadshotSound = Bundle.LoadAsset<AudioClip>("headshot");
			KillSound = Bundle.LoadAsset<AudioClip>("killsound");
			_rescueHookItem = ((DatabaseAsset<ItemDatabase, Item>)(object)SingletonAsset<ItemDatabase>.Instance).Objects.Where((Item item) => item.displayName == "Rescue Hook").FirstOrDefault();
			Player.Start += new hook_Start(MMHook_Postfix_AddKillingRevenue);
			Logger.LogInfo((object)"Done!");
		}

		private static void HookAll()
		{
			Logger.LogInfo((object)"Hooking...");
			RescueHookHook.Init();
			DiveBellHook.Init();
			Logger.LogInfo((object)"Done!");
		}

		private IEnumerator MMHook_Postfix_AddKillingRevenue(orig_Start orig, Player self)
		{
			IEnumerator _orig = orig.Invoke(self);
			while (_orig.MoveNext())
			{
				yield return _orig.Current;
			}
			if (IsOnSurface && _totalRewardForAllKills > 0)
			{
				UserInterface.ShowMoneyNotification("Killing revenue", $"${_totalRewardForAllKills}", (MoneyCellType)1);
				_totalRewardForAllKills = 0;
			}
		}

		private void RegisterSettings()
		{
			SettingsLoader.RegisterSetting("<size=75%>LAZERWEAPONRY SETTINGS</size>", "Rescue hook's lazer mode settings", (Setting)(object)new Damage());
			SettingsLoader.RegisterSetting("<size=75%>LAZERWEAPONRY SETTINGS</size>", "Rescue hook's lazer mode settings", (Setting)(object)new MaxAmmo());
			SettingsLoader.RegisterSetting("<size=75%>LAZERWEAPONRY SETTINGS</size>", "Rescue hook's lazer mode settings", (Setting)(object)new RecoilForce());
			SettingsLoader.RegisterSetting("<size=75%>LAZERWEAPONRY SETTINGS</size>", "Rescue hook's lazer mode settings", (Setting)(object)new DelayAfterFire());
			SettingsLoader.RegisterSetting("<size=75%>LAZERWEAPONRY SETTINGS</size>", "Rescue hook's lazer mode settings", (Setting)(object)new HeadshotDamageMultiplier());
			SettingsLoader.RegisterSetting("<size=75%>LAZERWEAPONRY SETTINGS</size>", "Rescue hook's lazer mode settings", (Setting)(object)new HeadshotFallTime());
			SettingsLoader.RegisterSetting("<size=75%>LAZERWEAPONRY SETTINGS</size>", "Rescue hook's lazer mode settings", (Setting)(object)new PlayerKillReward());
			SettingsLoader.RegisterSetting("<size=75%>LAZERWEAPONRY SETTINGS</size>", "Rescue hook's lazer mode settings", (Setting)(object)new MonsterKillReward());
			SettingsLoader.RegisterSetting("<size=75%>LAZERWEAPONRY SETTINGS</size>", "Sound settings", (Setting)(object)new HeadshotSoundVolume());
			SettingsLoader.RegisterSetting("<size=75%>LAZERWEAPONRY SETTINGS</size>", "Sound settings", (Setting)(object)new KillSoundVolume());
			SettingsLoader.RegisterSetting("<size=75%>LAZERWEAPONRY SETTINGS</size>", "Monster behaviour on hit", (Setting)(object)new MonsterFallTime());
			SettingsLoader.RegisterSetting("<size=75%>LAZERWEAPONRY SETTINGS</size>", "Monster behaviour on hit", (Setting)(object)new MonsterHitForceMultiplier());
			SettingsLoader.RegisterSetting("<size=75%>LAZERWEAPONRY SETTINGS</size>", "PvP settings", (Setting)(object)new PVPMode());
			SettingsLoader.RegisterSetting("<size=75%>LAZERWEAPONRY SETTINGS</size>", "PvP settings", (Setting)(object)new VulnerableEnemies());
		}

		private void RegisterSyncedSettings()
		{
			SyncedSettings.sync_PVPMode.ConfigChanged += delegate
			{
				Logger.LogWarning((object)$"Host dude changed PvP mode to {InitialSettings.PVPMode}!");
			};
			SyncedSettings.sync_Damage.ConfigChanged += delegate
			{
				Logger.LogWarning((object)$"Host dude changed damage to {InitialSettings.Damage}!");
			};
			SyncedSettings.sync_MaxAmmo.ConfigChanged += delegate
			{
				Logger.LogWarning((object)$"Host dude changed max ammo to {InitialSettings.MaxAmmo}!");
			};
			SyncedSettings.sync_DelayAfterFire.ConfigChanged += delegate
			{
				Logger.LogWarning((object)$"Host dude changed delay after fire to {InitialSettings.DelayAfterFire}!");
			};
			SyncedSettings.sync_HeadshotDamageMultiplier.ConfigChanged += delegate
			{
				Logger.LogWarning((object)$"Host dude changed headshot damage multiplier to {InitialSettings.HeadshotDamageMultiplier}!");
			};
			SyncedSettings.sync_MonsterFallTime.ConfigChanged += delegate
			{
				Logger.LogWarning((object)$"Host dude changed monster fall time to {InitialSettings.MonsterFallTime}!");
			};
			SyncedSettings.sync_MonsterHitForceMultiplier.ConfigChanged += delegate
			{
				Logger.LogWarning((object)$"Host dude changed monster force multiplier on hit to {InitialSettings.MonsterHitForceMultiplier}!");
			};
			SyncedSettings.sync_RecoilForce.ConfigChanged += delegate
			{
				Logger.LogWarning((object)$"Host dude changed recoil force to {InitialSettings.RecoilForce}!");
			};
			SyncedSettings.sync_PlayerKillReward.ConfigChanged += delegate
			{
				Logger.LogWarning((object)$"Host dude changed player kill reward to {InitialSettings.PlayerKillReward}!");
			};
			SyncedSettings.sync_MonsterKillReward.ConfigChanged += delegate
			{
				Logger.LogWarning((object)$"Host dude changed monster kill reward to {InitialSettings.MonsterKillReward}!");
			};
			SyncedSettings.sync_VulnerableEnemies.ConfigChanged += delegate
			{
				Logger.LogWarning((object)$"Host dude changed vulnerable enemies to {InitialSettings.VulnerableEnemies}!");
			};
			SyncedSettings.sync_HeadshotFallTime.ConfigChanged += delegate
			{
				Logger.LogWarning((object)$"Host dudeseter changed headshot fall time to {InitialSettings.HeadshotFallTime}!");
			};
		}

		private CSteamID GetSteamIdFromString(string rawSteamId)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (ulong.TryParse(rawSteamId, out var result))
			{
				return new CSteamID(result);
			}
			return default(CSteamID);
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private void HandleDamageToMortality(Collider mortalityCollider, float damage)
		{
			Mortality componentInParent = ((Component)mortalityCollider).GetComponentInParent<Mortality>();
			componentInParent.Damage(damage);
		}

		internal static void AddRescueHookToPlayer(Player player)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			PlayerInventory val = default(PlayerInventory);
			InventorySlot val2 = default(InventorySlot);
			InventorySlot val3 = default(InventorySlot);
			if (player.TryGetInventory(ref val) && !val.TryGetSlotWithItem(_rescueHookItem, ref val2) && val.TryAddItem(new ItemDescriptor(_rescueHookItem, new ItemInstanceData(Guid.NewGuid())), ref val3))
			{
				Logger.LogInfo((object)("Added rescue hook to " + ((MonoBehaviourPun)player).photonView.Owner.NickName));
				player.refs.view.RPC("RPC_SelectSlot", ((MonoBehaviourPun)player).photonView.Owner, new object[1] { val3.SlotID });
			}
		}

		internal static void AddRescueHookToAll()
		{
			foreach (Player item in PlayerHandler.instance.playersAlive)
			{
				AddRescueHookToPlayer(item);
			}
		}

		[CustomRPC]
		internal void RPC_ToggleBell(int bellIndex, bool toggle)
		{
			((Component)((Component)DiveBellParent.instance).transform.GetChild(bellIndex)).gameObject.SetActive(toggle);
		}

		[CustomRPC]
		internal void RPC_SpawnBellOwnerText(int bellIndex)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			Transform child = ((Component)DiveBellParent.instance).transform.GetChild(bellIndex);
			GameObject gameObject = ((Component)child.Find("Tools/Screen/ScreenPivot/Canvas/ACTIVE")).gameObject;
			GameObject val = Object.Instantiate<GameObject>(gameObject, gameObject.transform.position, new Quaternion(0f, 0f, 0f, 0f), gameObject.transform.parent);
			Transform transform = val.transform;
			Vector3 localPosition = val.transform.localPosition;
			localPosition.x = 0f;
			transform.localPosition = localPosition;
			Object.Destroy((Object)(object)val.GetComponent<GameObjectLocalizer>());
			TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
			((TMP_Text)component).text = ((MonoBehaviourPun)Player.localPlayer).photonView.Owner.NickName + "'s bell";
			((Graphic)component).color = Player.localPlayer.refs.visor.visorColor.value;
		}

		[CustomRPC]
		internal void RPC_SetLocalHelmetText(string stringToAdd, bool append, bool addCombo)
		{
			if (addCombo)
			{
				RescueHookHook.HeadshotCombo++;
			}
			if (append)
			{
				RescueHookHook.HelmetTextString += stringToAdd.Replace("<insertCombo>", RescueHookHook.HeadshotCombo.ToString());
			}
			else
			{
				RescueHookHook.HelmetTextString = stringToAdd.Replace("<insertCombo>", RescueHookHook.HeadshotCombo.ToString());
			}
		}

		[CustomRPC]
		internal void RPC_PlayLocalSound(int soundNumber, float volume)
		{
			if (1 == 0)
			{
			}
			AudioClip val = default(AudioClip);
			switch (soundNumber)
			{
			case 0:
				val = HeadshotSound;
				break;
			case 1:
				val = KillSound;
				break;
			default:
				if (1 == 0)
				{
				}
				global::<PrivateImplementationDetails>.ThrowSwitchExpressionException((SoundType)soundNumber);
				break;
			}
			if (1 == 0)
			{
			}
			AudioClip clip = val;
			RescueHookHook.PlaySoundEffect(clip, volume);
		}

		[CustomRPC]
		internal void RPC_ApplyLocalHelmetText()
		{
			((TMP_Text)HelmetText.Instance.m_TextObject).text = RescueHookHook.HelmetTextString;
			((Graphic)HelmetText.Instance.m_TextObject).SetAllDirty();
			((MonoBehaviour)this).StartCoroutine(RescueHookHook.WaitAndWipeHelmetTextAndCombo(5f));
		}

		[CustomRPC]
		internal void RPC_AppendLocalKillReward(string killedObjectName, int reward)
		{
			if (!IsOnSurface)
			{
				UserInterface.ShowMoneyNotification("Reward for killing " + killedObjectName, $"${reward}", (MoneyCellType)1);
				_totalRewardForAllKills += reward;
				SurfaceNetworkHandler.RoomStats.AddMoney(reward);
			}
		}

		[CustomRPC]
		internal void RPC_SpawnBullet(Vector3 position, Quaternion rotation, RPCInfo shooterInfo)
		{
			//IL_0007: 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)
			//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)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(Projectile, position, rotation);
			Projectile component = val.GetComponent<Projectile>();
			Player val2 = PlayerHandler.instance.players.First((Player player) => (CSteamID)ulong.Parse((string)player.refs.view.Owner.CustomProperties[(object)"SteamID"]) == shooterInfo.SenderSteamID);
			RescueHookHook.ChangeProjectileColor(val, val2.refs.visor.visorColor.value);
			component.damage = InitialSettings.Damage;
			component.hitAction = (Action<RaycastHit>)Delegate.Combine(component.hitAction, (Action<RaycastHit>)delegate(RaycastHit hit)
			{
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Invalid comparison between Unknown and I4
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0118: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a8: 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_0578: Unknown result type (might be due to invalid IL or missing references)
				//IL_024b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0267: Unknown result type (might be due to invalid IL or missing references)
				//IL_0326: Unknown result type (might be due to invalid IL or missing references)
				//IL_048a: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
				Player componentInParent = ((Component)((RaycastHit)(ref hit)).collider).GetComponentInParent<Player>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					string text = ((Object)((Component)((RaycastHit)(ref hit)).collider).transform.root).name.Replace("(Clone)", string.Empty).Replace("Toolkit_", string.Empty).Replace("2", string.Empty);
					string nickName = ((MonoBehaviourPun)componentInParent).photonView.Owner.NickName;
					bool flag = (int)componentInParent.refs.ragdoll.GetBodypartFromCollider(((RaycastHit)(ref hit)).collider).bodypartType == 4;
					int num = (int)((float)InitialSettings.Damage * InitialSettings.HeadshotDamageMultiplier) - InitialSettings.Damage;
					if (flag && !componentInParent.data.dead)
					{
						MyceliumNetwork.RPCTargetMasked(3913099u, "RPC_SetLocalHelmetText", shooterInfo.SenderSteamID, (ReliableType)1, LocalPhotonViewID, new object[3] { "headshot! (x<insertCombo>)\n", false, true });
						MyceliumNetwork.RPCTargetMasked(3913099u, "RPC_PlayLocalSound", shooterInfo.SenderSteamID, (ReliableType)1, LocalPhotonViewID, new object[2]
						{
							0,
							InitialSettings.HeadshotSoundVolume
						});
						if (!componentInParent.ai)
						{
							componentInParent.CallTakeDamageAndTase(MortalityLoaded ? 0f : ((float)num), InitialSettings.HeadshotFallTime);
						}
						if (MortalityLoaded)
						{
							HandleDamageToMortality(((RaycastHit)(ref hit)).collider, num);
						}
					}
					if (componentInParent.ai)
					{
						componentInParent.CallTakeDamageAndAddForceAndFall(0f, ((RaycastHit)(ref hit)).point * InitialSettings.MonsterHitForceMultiplier, InitialSettings.MonsterFallTime * (float)((!flag) ? 1 : 2));
						if (InitialSettings.VulnerableEnemies && MortalityLoaded)
						{
							HandleDamageToMortality(((RaycastHit)(ref hit)).collider, InitialSettings.Damage);
						}
					}
					if (componentInParent.data.sinceDied == 1000f && componentInParent.data.dead)
					{
						Bot val3 = null;
						if (!componentInParent.ai)
						{
							string text2 = ColorUtility.ToHtmlStringRGB(componentInParent.refs.visor.visorColor.value);
							MyceliumNetwork.RPCTargetMasked(3913099u, "RPC_SetLocalHelmetText", shooterInfo.SenderSteamID, (ReliableType)1, LocalPhotonViewID, new object[3]
							{
								"<color=red>killed</color> <color=#" + text2 + ">" + nickName + "!</color>",
								true,
								false
							});
						}
						else
						{
							val3 = ((Component)componentInParent).GetComponentInChildren<Bot>();
							string text3 = string.Empty;
							switch (val3.jumpScareLevel)
							{
							case 1:
								text3 = "white";
								break;
							case 0:
							case 2:
								text3 = "yellow";
								break;
							case 3:
								text3 = "red";
								break;
							}
							MyceliumNetwork.RPCTargetMasked(3913099u, "RPC_SetLocalHelmetText", shooterInfo.SenderSteamID, (ReliableType)1, LocalPhotonViewID, new object[3]
							{
								"<color=red>killed</color> <color=" + text3 + ">" + text + "!</color>",
								true,
								false
							});
						}
						Transform val4 = ((Component)((RaycastHit)(ref hit)).collider).transform;
						while ((Object)(object)val4.parent != (Object)null && (Object)(object)((Component)val4.parent).gameObject != (Object)(object)GameObject.Find("Game"))
						{
							val4 = val4.parent;
						}
						Object.Destroy((Object)(object)((Component)val4).gameObject, 15f);
						Logger.LogWarning((object)("HIT: " + ((Object)((Component)((RaycastHit)(ref hit)).collider).gameObject).name));
						Transform parent = ((Component)((RaycastHit)(ref hit)).collider).transform.parent;
						while ((Object)(object)parent != (Object)null)
						{
							Logger.LogWarning((object)("PARENT: " + ((Object)((Component)parent).gameObject).name));
							parent = parent.parent;
						}
						Logger.LogWarning((object)("DESTROYING " + ((Object)((Component)val4).gameObject).name + " In 15 Seconds!"));
						MyceliumNetwork.RPCTargetMasked(3913099u, "RPC_PlayLocalSound", shooterInfo.SenderSteamID, (ReliableType)1, LocalPhotonViewID, new object[2]
						{
							1,
							InitialSettings.KillSoundVolume
						});
						MyceliumNetwork.RPCTargetMasked(3913099u, "RPC_AppendLocalKillReward", shooterInfo.SenderSteamID, (ReliableType)1, LocalPhotonViewID, new object[2]
						{
							componentInParent.ai ? text : nickName,
							(!componentInParent.ai) ? new int?(InitialSettings.PlayerKillReward) : (InitialSettings.MonsterKillReward * ((val3 != null && val3.jumpScareLevel == 0) ? new int?(2) : val3?.jumpScareLevel))
						});
					}
					MyceliumNetwork.RPCTargetMasked(3913099u, "RPC_ApplyLocalHelmetText", shooterInfo.SenderSteamID, (ReliableType)1, LocalPhotonViewID, Array.Empty<object>());
				}
			});
		}

		[ConsoleCommand]
		public static void GiveEveryoneRescueHook()
		{
			if (MyceliumNetwork.IsHost && !MainMenuHandler.SteamLobbyHandler.IsPlayingWithRandoms())
			{
				AddRescueHookToAll();
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "cyclozarin.contentwarning.LazerWeaponry";

		public const string PLUGIN_NAME = "LazerWeaponry";

		public const string PLUGIN_VERSION = "0.0.0";
	}
}
namespace LazerWeaponry.Settings
{
	internal class Damage : IntSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			LazerWeaponryPlugin.SyncedSettings.sync_Damage.SetValue((object)((IntSetting)this).Value);
		}

		public string GetDisplayName()
		{
			return "Bullet damage";
		}

		protected override int GetDefaultValue()
		{
			return 10;
		}

		protected override (int, int) GetMinMaxValue()
		{
			return (5, 25);
		}
	}
	internal class DelayAfterFire : FloatSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			LazerWeaponryPlugin.SyncedSettings.sync_DelayAfterFire.SetValue((object)(float)Math.Round(((FloatSetting)this).Value, 2));
		}

		public string GetDisplayName()
		{
			return "Delay after firing bullet";
		}

		public override float GetDefaultValue()
		{
			return 0.15f;
		}

		public override float2 GetMinMaxValue()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return new float2(0.01f, 0.5f);
		}
	}
	internal class HeadshotDamageMultiplier : FloatSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			LazerWeaponryPlugin.SyncedSettings.sync_HeadshotDamageMultiplier.SetValue((object)(float)Math.Round(((FloatSetting)this).Value, 2));
		}

		public string GetDisplayName()
		{
			return "Damage multiplier on headshot";
		}

		public override float GetDefaultValue()
		{
			return 2f;
		}

		public override float2 GetMinMaxValue()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return new float2(1f, 4f);
		}
	}
	internal class HeadshotFallTime : FloatSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			LazerWeaponryPlugin.SyncedSettings.sync_HeadshotFallTime.SetValue((object)(float)Math.Round(((FloatSetting)this).Value, 2));
		}

		public string GetDisplayName()
		{
			return "Player fall time upon headshot";
		}

		public override float GetDefaultValue()
		{
			return 1.5f;
		}

		public override float2 GetMinMaxValue()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return new float2(0f, 3f);
		}
	}
	internal class HeadshotSoundVolume : IntSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			LazerWeaponryPlugin.InitialSettings.HeadshotSoundVolume = (float)((IntSetting)this).Value / 100f;
		}

		public string GetDisplayName()
		{
			return "Headshot sound volume";
		}

		protected override int GetDefaultValue()
		{
			return 75;
		}

		protected override (int, int) GetMinMaxValue()
		{
			return (0, 100);
		}
	}
	internal class KillSoundVolume : IntSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			LazerWeaponryPlugin.InitialSettings.KillSoundVolume = (float)((IntSetting)this).Value / 100f;
		}

		public string GetDisplayName()
		{
			return "Kill sound volume";
		}

		protected override int GetDefaultValue()
		{
			return 100;
		}

		protected override (int, int) GetMinMaxValue()
		{
			return (0, 100);
		}
	}
	internal class MaxAmmo : IntSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			LazerWeaponryPlugin.SyncedSettings.sync_MaxAmmo.SetValue((object)((IntSetting)this).Value);
		}

		public string GetDisplayName()
		{
			return "Ammo";
		}

		protected override int GetDefaultValue()
		{
			return 10;
		}

		protected override (int, int) GetMinMaxValue()
		{
			return (2, 20);
		}
	}
	internal class MonsterFallTime : FloatSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			LazerWeaponryPlugin.SyncedSettings.sync_MonsterFallTime.SetValue((object)(float)Math.Round(((FloatSetting)this).Value, 2));
		}

		public string GetDisplayName()
		{
			return "Monster fall time on hit";
		}

		public override float GetDefaultValue()
		{
			return 2f;
		}

		public override float2 GetMinMaxValue()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return new float2(0f, 5f);
		}
	}
	internal class MonsterHitForceMultiplier : FloatSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			LazerWeaponryPlugin.SyncedSettings.sync_MonsterHitForceMultiplier.SetValue((object)(float)Math.Round(((FloatSetting)this).Value, 2));
		}

		public string GetDisplayName()
		{
			return "Monster force multiplier on hit";
		}

		public override float GetDefaultValue()
		{
			return 0.25f;
		}

		public override float2 GetMinMaxValue()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return new float2(0f, 1f);
		}
	}
	internal class MonsterKillReward : IntSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			LazerWeaponryPlugin.SyncedSettings.sync_MonsterKillReward.SetValue((object)((IntSetting)this).Value);
		}

		public string GetDisplayName()
		{
			return "Money reward for killing monster";
		}

		protected override int GetDefaultValue()
		{
			return 15;
		}

		protected override (int, int) GetMinMaxValue()
		{
			return (5, 35);
		}
	}
	internal class PlayerKillReward : IntSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			LazerWeaponryPlugin.SyncedSettings.sync_PlayerKillReward.SetValue((object)((IntSetting)this).Value);
		}

		public string GetDisplayName()
		{
			return "Money reward for killing player";
		}

		protected override int GetDefaultValue()
		{
			return 35;
		}

		protected override (int, int) GetMinMaxValue()
		{
			return (20, 75);
		}
	}
	internal class PVPMode : BoolSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			LazerWeaponryPlugin.SyncedSettings.sync_PVPMode.SetValue((object)((BoolSetting)this).Value);
		}

		public string GetDisplayName()
		{
			return "PvP mode";
		}

		protected override bool GetDefaultValue()
		{
			return false;
		}
	}
	internal class RecoilForce : IntSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			LazerWeaponryPlugin.SyncedSettings.sync_RecoilForce.SetValue((object)((IntSetting)this).Value);
		}

		public string GetDisplayName()
		{
			return "Recoil force";
		}

		protected override int GetDefaultValue()
		{
			return 25;
		}

		protected override (int, int) GetMinMaxValue()
		{
			return (10, 50);
		}
	}
	internal class VulnerableEnemies : BoolSetting, ICustomSetting, IExposedSetting
	{
		public override void ApplyValue()
		{
			LazerWeaponryPlugin.SyncedSettings.sync_VulnerableEnemies.SetValue((object)((BoolSetting)this).Value);
		}

		public string GetDisplayName()
		{
			return "Vulnerable enemies";
		}

		protected override bool GetDefaultValue()
		{
			return false;
		}
	}
}
namespace LazerWeaponry.Hooks
{
	internal class DiveBellHook
	{
		private class NotReadyBecauseSomeoneIsAliveState : DivingBellState
		{
			public override void SetStatusText(TextMeshProUGUI statusText)
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				((TMP_Text)statusText).text = FillPlayerCountPlaceholder(_currentMessageForDiveBellNotBeingReadyBecauseSomeoneIsAlive);
				((Graphic)statusText).color = DivingBellState.RED;
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_GetSpawn <0>__MMHook_Prefix_IndividualRandomDiveBell;

			public static hook_Start <1>__MMHook_Postfix_DiveBellStuff;

			public static hook_Update <2>__MMHook_Prefix_ForceSwitchState;

			public static hook_Interact <3>__MMHook_Prefix_RestictLeavingWhenSomeoneIsAlive;

			public static hook_SetStatusText <4>__MMHook_Postfix_SetWinText;

			public static hook_TransitionGameFeel <5>__MMHook_Postfix_GenerateDiveBellIndexes;
		}

		private static bool _triedToSumbergeWhenSomeoneIsAlive = false;

		private static string _currentMessageForDiveBellNotBeingReadyBecauseSomeoneIsAlive = "";

		private static string _currentWinMessageForDiveBell = "you win!";

		private static int _currentDiveBellIndex;

		private static string[] _oldWorldEnterMessages = new string[3] { "You're alone now, with fear of sudden death and any counter of your friend.", "Friends that you happily met before now would battle not for live, but for death.", "Jokes are over, you arrived to the battlefield." };

		private static string[] _notReadyBecauseSomeoneIsAliveMessages = new string[6] { "cannot submerge when someone is alive, dumbass!", "you thought you can leave when <playerCount> player(-s) is alive, huh?", "you need to finish remaining people first. or just survive until you will be alone.", "<playerCount> people is certainly alive. submerge cancelled.", "error 0x0000000C: cannot submerge because diving bell is severely damaged", "your diveos license is expired! come back later when you will be able to afford it by killing." };

		private static string FillPlayerCountPlaceholder(string stringToFill)
		{
			return stringToFill.Replace("<playerCount>", (PlayerHandler.instance.playersAlive.Count - 1).ToString());
		}

		internal static void Init()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			object obj = <>O.<0>__MMHook_Prefix_IndividualRandomDiveBell;
			if (obj == null)
			{
				hook_GetSpawn val = MMHook_Prefix_IndividualRandomDiveBell;
				<>O.<0>__MMHook_Prefix_IndividualRandomDiveBell = val;
				obj = (object)val;
			}
			DiveBellParent.GetSpawn += (hook_GetSpawn)obj;
			object obj2 = <>O.<1>__MMHook_Postfix_DiveBellStuff;
			if (obj2 == null)
			{
				hook_Start val2 = MMHook_Postfix_DiveBellStuff;
				<>O.<1>__MMHook_Postfix_DiveBellStuff = val2;
				obj2 = (object)val2;
			}
			DivingBell.Start += (hook_Start)obj2;
			object obj3 = <>O.<2>__MMHook_Prefix_ForceSwitchState;
			if (obj3 == null)
			{
				hook_Update val3 = MMHook_Prefix_ForceSwitchState;
				<>O.<2>__MMHook_Prefix_ForceSwitchState = val3;
				obj3 = (object)val3;
			}
			DivingBell.Update += (hook_Update)obj3;
			object obj4 = <>O.<3>__MMHook_Prefix_RestictLeavingWhenSomeoneIsAlive;
			if (obj4 == null)
			{
				hook_Interact val4 = MMHook_Prefix_RestictLeavingWhenSomeoneIsAlive;
				<>O.<3>__MMHook_Prefix_RestictLeavingWhenSomeoneIsAlive = val4;
				obj4 = (object)val4;
			}
			UseDivingBellButton.Interact += (hook_Interact)obj4;
			object obj5 = <>O.<4>__MMHook_Postfix_SetWinText;
			if (obj5 == null)
			{
				hook_SetStatusText val5 = MMHook_Postfix_SetWinText;
				<>O.<4>__MMHook_Postfix_SetWinText = val5;
				obj5 = (object)val5;
			}
			DivingBellReadyState.SetStatusText += (hook_SetStatusText)obj5;
			object obj6 = <>O.<5>__MMHook_Postfix_GenerateDiveBellIndexes;
			if (obj6 == null)
			{
				hook_TransitionGameFeel val6 = MMHook_Postfix_GenerateDiveBellIndexes;
				<>O.<5>__MMHook_Postfix_GenerateDiveBellIndexes = val6;
				obj6 = (object)val6;
			}
			DivingBell.TransitionGameFeel += (hook_TransitionGameFeel)obj6;
		}

		private static void MMHook_Postfix_SetWinText(orig_SetStatusText orig, DivingBellReadyState self, TextMeshProUGUI statusText)
		{
			orig.Invoke(self, statusText);
			if (!self.OnSurface && LazerWeaponryPlugin.InitialSettings.PVPMode && PlayerHandler.instance.playersAlive.Count == 1)
			{
				((TMP_Text)statusText).text = _currentWinMessageForDiveBell;
			}
		}

		private static void MMHook_Prefix_ForceSwitchState(orig_Update orig, DivingBell self)
		{
			DivingBell self2 = self;
			PlayerHandler.instance.players.ForEach(delegate(Player p)
			{
				p.data.isInDiveBell = self2.playerDetector.CheckForPlayers().Contains(p);
			});
			if (LazerWeaponryPlugin.InitialSettings.PVPMode && !self2.onSurface)
			{
				if (PlayerHandler.instance.playersAlive.Count == 1)
				{
					((StateMachine<DivingBellState>)(object)self2.StateMachine).SwitchState<DivingBellReadyState>();
					return;
				}
				if (_triedToSumbergeWhenSomeoneIsAlive)
				{
					((StateMachine<DivingBellState>)(object)self2.StateMachine).SwitchState<NotReadyBecauseSomeoneIsAliveState>();
					return;
				}
			}
			orig.Invoke(self2);
		}

		private static void MMHook_Prefix_RestictLeavingWhenSomeoneIsAlive(orig_Interact orig, UseDivingBellButton self, Player player)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			if (PlayerHandler.instance.playersAlive.Count != 1 && LazerWeaponryPlugin.InitialSettings.PVPMode && !self.divingBell.onSurface)
			{
				((Interactable)self).hoverText = "unable to submerge";
				self.divingBell.sfx.notAll.Play(((Component)self.divingBell).transform.position, false, 1f, (Transform)null);
				_triedToSumbergeWhenSomeoneIsAlive = true;
			}
			else
			{
				orig.Invoke(self, player);
			}
		}

		private static IEnumerator WaitForOthersAndDoStuff(DivingBell bell)
		{
			yield return (object)new WaitUntil((Func<bool>)(() => PlayerHandler.instance.playersAlive.Contains(Player.localPlayer)));
			if (MyceliumNetwork.IsHost)
			{
				MyceliumNetwork.SetLobbyData("diveBellArrivingMessage", (object)_oldWorldEnterMessages[Random.Range(0, _oldWorldEnterMessages.Length)]);
			}
			yield return (object)new WaitUntil((Func<bool>)(() => PlayerHandler.instance.playersAlive.Count == MyceliumNetwork.PlayerCount));
			bell.AttemptSetOpen(true);
			if (MyceliumNetwork.IsHost)
			{
				LazerWeaponryPlugin.AddRescueHookToAll();
			}
			MyceliumNetwork.RPC(3913099u, "RPC_SpawnBellOwnerText", (ReliableType)1, new object[1] { _currentDiveBellIndex });
			HelmetText.Instance.SetHelmetText(MyceliumNetwork.GetLobbyData<string>("diveBellArrivingMessage"), 3f);
			yield return (object)new WaitForSecondsRealtime(10f);
			HelmetText.Instance.SetHelmetText("\n<color=red>Good luck.</color>", 3f);
		}

		private static void MMHook_Postfix_DiveBellStuff(orig_Start orig, DivingBell self)
		{
			orig.Invoke(self);
			if (MyceliumNetwork.InLobby)
			{
				((StateMachine<DivingBellState>)(object)self.StateMachine).RegisterState((DivingBellState)(object)new NotReadyBecauseSomeoneIsAliveState());
				if (self.onSurface)
				{
					self.AttemptSetOpen(true);
				}
			}
		}

		private static void MMHook_Postfix_GenerateDiveBellIndexes(orig_TransitionGameFeel orig, DivingBell self)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (MyceliumNetwork.IsHost)
			{
				State state = Random.state;
				int hashCode = Guid.NewGuid().GetHashCode();
				Random.InitState(hashCode);
				LazerWeaponryPlugin.Logger.LogDebug((object)$"generated seed {hashCode} for generating dive bell spawn locations");
				byte[] array = new byte[MyceliumNetwork.PlayerCount];
				string text = new List<string> { "FactoryScene", "MinesScene", "HarbourScene" }[SurfaceNetworkHandler.RoomStats.LevelToPlay];
				LazerWeaponryPlugin.Logger.LogDebug((object)$"generating dive bell locations for {text} on day {SurfaceNetworkHandler.RoomStats.CurrentDay}");
				for (int i = 0; i < MyceliumNetwork.PlayerCount; i++)
				{
					int num = Random.Range(0, LazerWeaponryPlugin.MapNameToDiveBellCount[text] - 1);
					array[i] = (byte)num;
					LazerWeaponryPlugin.Logger.LogDebug((object)$"will spawn {SteamFriends.GetFriendPersonaName(MyceliumNetwork.Players[i])} at bell #{num}");
				}
				MyceliumNetwork.SetLobbyData("diveBellIndexes", (object)Convert.ToBase64String(array));
				LazerWeaponryPlugin.Logger.LogDebug((object)"done generating dive bell spawn locations, rolling back to previous random state");
				Random.state = state;
			}
		}

		private static SpawnPoint MMHook_Prefix_IndividualRandomDiveBell(orig_GetSpawn orig, DiveBellParent self)
		{
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			if (LazerWeaponryPlugin.InitialSettings.PVPMode)
			{
				byte[] array = Convert.FromBase64String(MyceliumNetwork.GetLobbyData<string>("diveBellIndexes"));
				LazerWeaponryPlugin.Logger.LogDebug((object)("received dive bell indexes: " + string.Join(" ", array)));
				for (int i = 0; i < ((Component)self).transform.childCount; i++)
				{
					((Component)((Component)self).transform.GetChild(i)).gameObject.SetActive(false);
				}
				for (int j = 0; j < array.Length; j++)
				{
					((Component)((Component)self).transform.GetChild((int)array[j])).gameObject.SetActive(true);
				}
				int num = Array.IndexOf(MyceliumNetwork.Players, MyceliumNetwork.Players.First((CSteamID player) => SteamFriends.GetFriendPersonaName(player) == SteamFriends.GetPersonaName()));
				_currentMessageForDiveBellNotBeingReadyBecauseSomeoneIsAlive = _notReadyBecauseSomeoneIsAliveMessages[Random.Range(0, _notReadyBecauseSomeoneIsAliveMessages.Length)];
				_currentDiveBellIndex = array[num];
				DivingBell component = ((Component)((Component)self).transform.GetChild(_currentDiveBellIndex)).gameObject.GetComponent<DivingBell>();
				((MonoBehaviour)self).StartCoroutine(WaitForOthersAndDoStuff(component));
				LazerWeaponryPlugin.Logger.LogDebug((object)$"player index: {num} bell index: {_currentDiveBellIndex}");
				return ((Component)((Component)self).transform.GetChild(_currentDiveBellIndex)).GetComponentInChildren<SpawnPoint>();
			}
			return orig.Invoke(self);
		}
	}
	public class RescueHookHook
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Start <0>__MMHook_Postfix_SetRescueHookDataOnStart;

			public static hook_Update <1>__MMHook_Postfix_ToggleRescueHookModeAndCheckForIt;

			public static hook_Fire <2>__MMHook_Prefix_LazersInRescueHook;

			public static hook_Start <3>__MMHook_Postfix_CreateCustomSourcesAndReregisterInMycelium;
		}

		private static bool _lazerMode = false;

		private static bool _ableToFire = true;

		private static bool _firedWhileAgo = false;

		private static bool _recharging = false;

		private static float _rechargeTime = 3f;

		private static AudioSource _chargeSource = null;

		private static AudioSource _customSource = null;

		private static string _sourceName = "LazerWeaponry source";

		private static Coroutine? _hookRechargeCoroutine = null;

		internal static int HeadshotCombo = 0;

		internal static string HelmetTextString = "";

		private static IEnumerator StartDelayAfterFire()
		{
			_ableToFire = false;
			yield return (object)new WaitForSecondsRealtime(LazerWeaponryPlugin.InitialSettings.DelayAfterFire);
			_ableToFire = true;
		}

		private static IEnumerator DelayAndHookRecharge(RescueHook hook)
		{
			yield return (object)new WaitForSecondsRealtime(_rechargeTime);
			_recharging = true;
			while (hook.m_batteryEntry.m_charge != hook.m_batteryEntry.m_maxCharge)
			{
				hook.m_batteryEntry.AddCharge(1f);
				((Behaviour)_chargeSource).enabled = true;
				_chargeSource.PlayOneShot(_chargeSource.clip);
				_chargeSource.volume = Mathf.Lerp(_chargeSource.volume, 0.1f, Time.deltaTime * 10f);
				_chargeSource.pitch = Mathf.Lerp(_chargeSource.pitch, 0.25f + hook.m_batteryEntry.m_charge * 4f, Time.deltaTime * 10f);
				yield return (object)new WaitForSecondsRealtime(0.01f);
			}
			_recharging = false;
			_chargeSource.pitch = 1f;
			_chargeSource.volume = 0.01f;
			((Behaviour)_chargeSource).enabled = false;
			_hookRechargeCoroutine = null;
		}

		internal static IEnumerator WaitAndWipeHelmetTextAndCombo(float time)
		{
			yield return (object)new WaitForSecondsRealtime(time);
			HelmetTextString = "";
			((TMP_Text)HelmetText.Instance.m_TextObject).text = "";
			HeadshotCombo = 0;
		}

		internal static void ChangeProjectileColor(GameObject projectile, Color color)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			MeshRenderer componentInChildren = projectile.GetComponentInChildren<MeshRenderer>();
			ParticleSystemRenderer component = projectile.GetComponent<Projectile_SpawnObject>().objectToSpawn.GetComponent<ParticleSystemRenderer>();
			Material material = ((Renderer)componentInChildren).material;
			Material val = ((Renderer)component).materials[1];
			material.color = color;
			material.SetColor("_BaseMap", color);
			material.SetColor("_Emission", color * 30f);
			val.color = color;
			val.SetColor("_BaseMap", color);
			val.SetColor("_Emission", color * 30f);
			((Renderer)componentInChildren).material = material;
			((Renderer)component).material = val;
		}

		private static void ChangeRescueHookBeamColor(RescueHook hook)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			Material material = ((Renderer)hook.lightObject.GetComponentInChildren<MeshRenderer>()).material;
			? color;
			if (!_lazerMode)
			{
				color = new Color(1f, 0.57f, 0f, 0.027f);
			}
			else
			{
				Color red = Color.red;
				red.a = 0.2f;
				color = red;
			}
			material.color = (Color)color;
		}

		internal static void PlaySoundEffect(AudioClip clip, float volume)
		{
			_customSource.PlayOneShot(clip, volume);
		}

		internal static void Init()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			object obj = <>O.<0>__MMHook_Postfix_SetRescueHookDataOnStart;
			if (obj == null)
			{
				hook_Start val = MMHook_Postfix_SetRescueHookDataOnStart;
				<>O.<0>__MMHook_Postfix_SetRescueHookDataOnStart = val;
				obj = (object)val;
			}
			RescueHook.Start += (hook_Start)obj;
			object obj2 = <>O.<1>__MMHook_Postfix_ToggleRescueHookModeAndCheckForIt;
			if (obj2 == null)
			{
				hook_Update val2 = MMHook_Postfix_ToggleRescueHookModeAndCheckForIt;
				<>O.<1>__MMHook_Postfix_ToggleRescueHookModeAndCheckForIt = val2;
				obj2 = (object)val2;
			}
			RescueHook.Update += (hook_Update)obj2;
			object obj3 = <>O.<2>__MMHook_Prefix_LazersInRescueHook;
			if (obj3 == null)
			{
				hook_Fire val3 = MMHook_Prefix_LazersInRescueHook;
				<>O.<2>__MMHook_Prefix_LazersInRescueHook = val3;
				obj3 = (object)val3;
			}
			RescueHook.Fire += (hook_Fire)obj3;
			object obj4 = <>O.<3>__MMHook_Postfix_CreateCustomSourcesAndReregisterInMycelium;
			if (obj4 == null)
			{
				hook_Start val4 = MMHook_Postfix_CreateCustomSourcesAndReregisterInMycelium;
				<>O.<3>__MMHook_Postfix_CreateCustomSourcesAndReregisterInMycelium = val4;
				obj4 = (object)val4;
			}
			Player.Start += (hook_Start)obj4;
		}

		private static IEnumerator MMHook_Postfix_CreateCustomSourcesAndReregisterInMycelium(orig_Start orig, Player self)
		{
			IEnumerator _orig = orig.Invoke(self);
			while (_orig.MoveNext())
			{
				yield return _orig.Current;
			}
			if (!self.ai)
			{
				_chargeSource = ((Component)self).GetComponent<PlayerDataSounds>().throwCharge;
				GameObject _customSourceObject = GameObject.Find(_sourceName);
				if ((Object)(object)GameObject.Find(_sourceName) == (Object)null)
				{
					GameObject _sourceObject = Object.Instantiate<GameObject>(new GameObject(_sourceName), self.HeadPosition(), self.refs.headPos.rotation);
					((Object)_sourceObject).hideFlags = (HideFlags)61;
					_customSource = _sourceObject.AddComponent<AudioSource>();
					Object.DontDestroyOnLoad((Object)(object)_sourceObject);
				}
				else
				{
					_customSource = _customSourceObject.GetComponent<AudioSource>();
				}
				MyceliumNetwork.RegisterNetworkObject((object)LazerWeaponryPlugin.Instance, 3913099u, LazerWeaponryPlugin.LocalPhotonViewID);
			}
		}

		private static void MMHook_Postfix_SetRescueHookDataOnStart(orig_Start orig, RescueHook self)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			orig.Invoke(self);
			List<ItemKeyTooltip> tooltips = ((ItemInstanceBehaviour)self).itemInstance.item.Tooltips;
			if (!tooltips.Any((ItemKeyTooltip x) => x.m_key == "[R] Toggle lazer mode"))
			{
				tooltips.Add(new ItemKeyTooltip("[R] Toggle lazer mode"));
			}
			ChangeRescueHookBeamColor(self);
			if (_recharging || self.m_batteryEntry.m_charge == 0f)
			{
				LazerWeaponryPlugin.Logger.LogDebug((object)"rescue hook was switched to different slot, we'll charge it");
				((MonoBehaviour)self).StartCoroutine(DelayAndHookRecharge(self));
			}
		}

		private static void MMHook_Postfix_ToggleRescueHookModeAndCheckForIt(orig_Update orig, RescueHook self)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			try
			{
				PlayerInventory val = default(PlayerInventory);
				Player.localPlayer.TryGetInventory(ref val);
				ItemDescriptor val2 = default(ItemDescriptor);
				val.TryGetItemInSlot(Player.localPlayer.data.selectedItemSlot, ref val2);
				((Behaviour)_chargeSource).enabled = (Object)(object)val2.item == (Object)(object)((ItemInstanceBehaviour)self).itemInstance.item && !_firedWhileAgo;
				if (_lazerMode)
				{
					self.isPulling = false;
				}
				if (((ItemInstanceBehaviour)self).isHeldByMe && self.playerHoldingItem.input.toggleCameraFlipWasPressed && !self.playerHoldingItem.HasLockedInput() && GlobalInputHandler.CanTakeInput())
				{
					_lazerMode = !_lazerMode;
					ChangeRescueHookBeamColor(self);
				}
			}
			catch
			{
			}
		}

		private static void MMHook_Prefix_LazersInRescueHook(orig_Fire orig, RescueHook self)
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: 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)
			if (LazerWeaponryPlugin.InitialSettings.PVPMode)
			{
				_firedWhileAgo = true;
				if (_hookRechargeCoroutine != null)
				{
					((MonoBehaviour)self).StopCoroutine(_hookRechargeCoroutine);
				}
				_hookRechargeCoroutine = ((MonoBehaviour)self).StartCoroutine(DelayAndHookRecharge(self));
			}
			if (_lazerMode)
			{
				if (_ableToFire)
				{
					self.m_batteryEntry.AddCharge((0f - self.m_batteryEntry.m_maxCharge) / (float)LazerWeaponryPlugin.InitialSettings.MaxAmmo);
					MyceliumNetwork.RPC(3913099u, "RPC_SpawnBullet", (ReliableType)1, new object[2]
					{
						self.dragPoint.position + self.dragPoint.forward * 1.5f + Vector3.down * 0.15f + Vector3.left * 0.05f,
						Quaternion.LookRotation(self.dragPoint.forward)
					});
					self.playerHoldingItem.CallAddForceToBodyParts(new int[1] { self.playerHoldingItem.refs.ragdoll.GetBodyPartID((BodypartType)10) }, (Vector3[])(object)new Vector3[1] { -self.dragPoint.forward * (float)LazerWeaponryPlugin.InitialSettings.RecoilForce });
					((MonoBehaviour)self).StartCoroutine(StartDelayAfterFire());
				}
			}
			else
			{
				orig.Invoke(self);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}