Decompiled source of abandonedcompanyassets v0.15.79

AbandonedCompanyAssets.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AbandonedCompanyAssets.Behaviours;
using AbandonedCompanyAssets.NetcodePatcher;
using AbandonedCompanyAssets.itemStuff;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("AbandonedCompanyAssets")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Find abandoned company assets.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AbandonedCompanyAssets")]
[assembly: AssemblyTitle("AbandonedCompanyAssets")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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;
		}
	}
}
namespace AbandonedCompanyAssets
{
	public static class Configs
	{
		public static bool spawnEquipmentInFacility = true;

		public static int maxEquipmentSpawns = 8;

		public static int minEquipmentSpawns = 2;
	}
	public static class assetCall
	{
		private static string assetFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "abandonedcompanypropertyitems");

		public static AssetBundle bundle = AssetBundle.LoadFromFile(assetFile);
	}
	[BepInPlugin("AbandonedCompanyAssets", "AbandonedCompanyAssets", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private enum spawnRate
		{
			Legendary = 5,
			Epic = 10,
			Rare = 20,
			Uncommon = 30,
			Common = 40,
			Extremely_Common = 50,
			Too_Common = 75,
			Cheating = 1000,
			NonSpawning = 0
		}

		internal static ManualLogSource ACALog;

		public static Item candle = assetCall.bundle.LoadAsset<Item>("Assets/Items/candle/candleItem.asset");

		public static Item glowstick = assetCall.bundle.LoadAsset<Item>("Assets/Items/glowstick/glowstickItem.asset");

		public static Item GlowstickDroppedItem = assetCall.bundle.LoadAsset<Item>("Assets/Items/glowstick/glowstickItem(Dropped).asset");

		public static Item lighter = assetCall.bundle.LoadAsset<Item>("Assets/Items/lighter/Lighter.asset");

		public static Item bulletLighter = assetCall.bundle.LoadAsset<Item>("Assets/Items/bulletLighter/bulletLighter.asset");

		public static GameObject webBurnParticles = assetCall.bundle.LoadAsset<GameObject>("Assets/Items/lighter/webFire.prefab");

		public static Item signalFlareItem = assetCall.bundle.LoadAsset<Item>("Assets/Items/emergencyFlare/signalFlareItem.asset");

		public static GameObject signalFlareParticles = assetCall.bundle.LoadAsset<GameObject>("Assets/Items/emergencyFlare/signalFlare (1) 1.prefab");

		public static Item abandonedflashlightitem = assetCall.bundle.LoadAsset<Item>("Assets/Items/bbflashlight/abandonedBBFlashlight.asset");

		public static Item industrialflashlightitem = assetCall.bundle.LoadAsset<Item>("Assets/Items/industrialflashlight/industrialFlashlightItem.asset");

		public static Item proabaondedflashlightitem = assetCall.bundle.LoadAsset<Item>("Assets/Items/proflashlight/ProAbandonedFlashlight.asset");

		public static Item abandonedWalkieItem = assetCall.bundle.LoadAsset<Item>("Assets/Items/AbandonedWalkie/AbandonedWalkieItem.asset");

		public static Item abandonedTZPItem = assetCall.bundle.LoadAsset<Item>("Assets/Items/TZP-Abandoned/AbandonedTZPItem.asset");

		public static Plugin instance;

		private static bool EnableFlare = true;

		private static bool EnableGlowsticks = true;

		private static bool EnableRandomGlowsticks = true;

		private static bool EnableLighter = true;

		private static bool EnableDungeonCandle = true;

		private static bool EnableShopCandle = true;

		private static bool EnableAbandonedFlashlight = true;

		private static bool FlareCompatName = false;

		private static bool EnableIndustrialFlashlight = true;

		private static bool EnableProAbandonedFlashlight = true;

		private static bool EnableAbandonedWalkie = true;

		private static bool EnableAbandonedTZP = true;

		private static int CandleSpawnWeight = 10;

		private static int LighterSpawnWeight = 20;

		private static int BulletLighterSpawnWeight = 2;

		private static int AbandonedBBFlashSpawnWeight = 30;

		private static int AbandonedProFlashSpawnWeight = 20;

		private static int IndustrialFlashlightSpawnWeight = 5;

		private static int AbandonedWalkieSpawnWeight = 20;

		private static int AbandonedTZPSpawnWeight = 60;

		private static int DroppedGlowstickSpawnWeight = 10;

		public void Awake()
		{
			instance = this;
			ACALog = ((BaseUnityPlugin)this).Logger;
			loadConfig();
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			for (int i = 0; i < types.Length; i++)
			{
				MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			NetworkPrefabs.RegisterNetworkPrefab(candle.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(glowstick.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(GlowstickDroppedItem.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(lighter.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(webBurnParticles);
			NetworkPrefabs.RegisterNetworkPrefab(bulletLighter.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(signalFlareItem.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(signalFlareParticles);
			NetworkPrefabs.RegisterNetworkPrefab(abandonedflashlightitem.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(industrialflashlightitem.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(proabaondedflashlightitem.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(abandonedWalkieItem.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(abandonedTZPItem.spawnPrefab);
			Utilities.FixMixerGroups(candle.spawnPrefab);
			Utilities.FixMixerGroups(GlowstickDroppedItem.spawnPrefab);
			Utilities.FixMixerGroups(glowstick.spawnPrefab);
			Utilities.FixMixerGroups(lighter.spawnPrefab);
			Utilities.FixMixerGroups(bulletLighter.spawnPrefab);
			Utilities.FixMixerGroups(bulletLighter.spawnPrefab);
			Utilities.FixMixerGroups(signalFlareItem.spawnPrefab);
			Utilities.FixMixerGroups(webBurnParticles);
			Utilities.FixMixerGroups(signalFlareParticles);
			Utilities.FixMixerGroups(abandonedflashlightitem.spawnPrefab);
			Utilities.FixMixerGroups(industrialflashlightitem.spawnPrefab);
			Utilities.FixMixerGroups(proabaondedflashlightitem.spawnPrefab);
			Utilities.FixMixerGroups(abandonedWalkieItem.spawnPrefab);
			Utilities.FixMixerGroups(abandonedTZPItem.spawnPrefab);
			if (EnableGlowsticks)
			{
				Items.RegisterScrap(GlowstickDroppedItem, DroppedGlowstickSpawnWeight, (LevelTypes)(-1));
			}
			if (EnableDungeonCandle)
			{
				Items.RegisterScrap(candle, CandleSpawnWeight, (LevelTypes)(-1));
			}
			if (EnableLighter)
			{
				Items.RegisterScrap(lighter, LighterSpawnWeight, (LevelTypes)(-1));
				Items.RegisterScrap(bulletLighter, BulletLighterSpawnWeight, (LevelTypes)(-1));
			}
			if (EnableAbandonedFlashlight)
			{
				Items.RegisterScrap(abandonedflashlightitem, AbandonedBBFlashSpawnWeight, (LevelTypes)(-1));
			}
			if (EnableIndustrialFlashlight)
			{
				Items.RegisterScrap(industrialflashlightitem, IndustrialFlashlightSpawnWeight, (LevelTypes)(-1));
			}
			if (EnableProAbandonedFlashlight)
			{
				Items.RegisterScrap(proabaondedflashlightitem, AbandonedProFlashSpawnWeight, (LevelTypes)(-1));
			}
			if (EnableAbandonedWalkie)
			{
				Items.RegisterScrap(abandonedWalkieItem, AbandonedWalkieSpawnWeight, (LevelTypes)(-1));
			}
			if (EnableAbandonedTZP)
			{
				Items.RegisterScrap(abandonedTZPItem, AbandonedTZPSpawnWeight, (LevelTypes)(-1));
			}
			lighter.toolTips = new string[1] { "Light Flip Lighter : [LMB]" };
			bulletLighter.toolTips = new string[1] { "Light Bullet Lighter : [LMB]" };
			candle.toolTips = new string[1] { "Use item : [LMB]" };
			glowstick.toolTips = new string[1] { "Drop Glowstick : [LMB]" };
			CandleStuff.minFail = 1;
			CandleStuff.maxFail = 4;
			TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
			val.clearPreviousText = true;
			val.displayText = "The Candle. A cheap but extremely unreliable method of lighting your way. The Company is not responsible for any fires.\n\n";
			if (EnableShopCandle)
			{
				Items.RegisterShopItem(candle, (TerminalNode)null, (TerminalNode)null, val, 7);
			}
			if (EnableRandomGlowsticks)
			{
				Items.RegisterShopItem(glowstick, 15);
			}
			if (EnableFlare)
			{
				Items.RegisterShopItem(signalFlareItem, 100);
			}
			if (FlareCompatName)
			{
				signalFlareItem.itemName = "Military Flare";
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin AbandonedCompanyAssets is loaded!");
		}

		private void loadConfig()
		{
			FlareCompatName = ((BaseUnityPlugin)this).Config.Bind<bool>("Extra", "EnableFlareCompatibilityName", false, "Should the Emergency Flare's name be changed to improve compatibility? [Default: false]").Value;
			EnableFlare = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableFlare", true, "Should the Emergency Flare be available in the shop?").Value;
			EnableGlowsticks = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableGlowsticks", true, "Should the Glowsticks be available in the shop?").Value;
			EnableLighter = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableLighter", true, "Should the Lighters spawn in the dungeon?").Value;
			EnableShopCandle = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableShopCandle", true, "Should the Antique Candles be available in the shop?").Value;
			EnableDungeonCandle = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableDungeonCandle", true, "Should the Antique Candles spawn in the dungeon?").Value;
			EnableAbandonedFlashlight = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableBBFlashlight", true, "Should the Abandoned Flashlights spawn in the dungeon?").Value;
			EnableRandomGlowsticks = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableRandomGlowsticks", true, "Should the random glowsticks spawn in the dungeon?").Value;
			EnableIndustrialFlashlight = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableIndustrialFlashlight", true, "Should the Industrial Flashlight spawn in the dungeon?").Value;
			EnableProAbandonedFlashlight = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableProAbandonedFlashlight", true, "Should the Abandoned Pro-Flashlight spawn in the dungeon?").Value;
			EnableAbandonedWalkie = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableAbandonedWalkieTalkie", true, "Should the Abandoned Walkie-Talkie spawn in the dungeon?").Value;
			EnableAbandonedTZP = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableAbandonedTZP", true, "Should the Abandoned TZP-Inhaler spawn in the dungeon?").Value;
			CandleSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Weights", "CandleSpawnWeight", 10, "What should the spawn weight of the Antique Candle be? [Default: 10]").Value;
			LighterSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Weights", "LighterSpawnWeight", 20, "What should the spawn weight of the Lighter be? [Default: 20]").Value;
			BulletLighterSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Weights", "BulletLighterSpawnWeight", 2, "What should the spawn weight of the Bullet Lighter be? [Default: 2]").Value;
			AbandonedBBFlashSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Weights", "AbandonedBBFlashSpawnWeight", 30, "What should the spawn weight of the Abandoned Flashlight be? [Default: 30]").Value;
			AbandonedProFlashSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Weights", "AbandonedProFlashSpawnWeight", 20, "What should the spawn weight of the Abandoned Pro-Flashlight be? [Default: 20]").Value;
			IndustrialFlashlightSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Weights", "IndustrialFlashlightSpawnWeight", 5, "What should the spawn weight of the Industrial Flashlight be? [Default: 5]").Value;
			AbandonedWalkieSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Weights", "AbandonedWalkieSpawnWeight", 20, "What should the spawn weight of the Abandoned Walkie-Talkie be? [Default: 20]").Value;
			AbandonedTZPSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Weights", "AbandonedTZPSpawnWeight", 60, "What should the spawn weight of the Abandoned TZP-Inhaler be? [Default: 60]").Value;
			DroppedGlowstickSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Weights", "DropedGlowstickSpawnWeight", 10, "What should the spawn weight of the Dropped Glowstick be? [Default: 10]").Value;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "AbandonedCompanyAssets";

		public const string PLUGIN_NAME = "AbandonedCompanyAssets";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace AbandonedCompanyAssets.itemStuff
{
	internal class AbandonedFlashlightStuff : FlashlightItem
	{
		private int randomtrait;

		private bool traitGenerated;

		private float randomflickertime;

		private float flickertimer;

		private bool flickeron;

		private float flickertimebetween;

		private FlickeringLight playerlightsource;

		private AudioSource audiosource;

		public float defaultminintensity = 120f;

		public float defaultmaxintensity = 50f;

		public int defaultsmoothing = 20;

		private float randomchance;

		public bool isfaulty = true;

		public bool chargeonship;

		private float maintimer;

		private float revealtime;

		private float randomdroptime;

		private float droptimer;

		private float bulbfailtimer;

		private float randombulbfailtime;

		private int bulbfailures;

		private int maxbulbfailures;

		public static AudioClip bulbflicker = assetCall.bundle.LoadAsset<AudioClip>("Assets/Items/bbflashlight/flashlight flicker.wav");

		public static AudioClip bulbexplosion = assetCall.bundle.LoadAsset<AudioClip>("Assets/Items/bbflashlight/flashlight bulb explode.wav");

		public override void LoadItemSaveData(int saveData)
		{
			((GrabbableObject)this).LoadItemSaveData(saveData);
			Plugin.ACALog.LogInfo((object)("Load Data:" + saveData));
			randomtrait = saveData;
		}

		public override int GetItemDataToSave()
		{
			((GrabbableObject)this).GetItemDataToSave();
			Plugin.ACALog.LogInfo((object)("Save Data:" + randomtrait));
			return randomtrait;
		}

		public override void Start()
		{
			((FlashlightItem)this).Start();
			if (Random.Range(0f, 100f) <= 1f)
			{
				((Component)this).gameObject.GetComponentInChildren<ScanNodeProperties>().subText = "(PlatformEffectfor2DEditor)";
			}
			audiosource = ((Component)this).GetComponent<AudioSource>();
			((GrabbableObject)this).isBeingUsed = false;
			if (maxbulbfailures == 0)
			{
				maxbulbfailures = Random.Range(2, 5);
			}
			if (((GrabbableObject)((Component)this).gameObject.GetComponent<FlashlightItem>()).insertedBattery.charge == 0f && isfaulty)
			{
				((GrabbableObject)((Component)this).GetComponent<FlashlightItem>()).insertedBattery.charge = 1f * Random.Range(0.2f, 0.95f);
			}
			else
			{
				((GrabbableObject)((Component)this).GetComponent<FlashlightItem>()).insertedBattery.charge = 1f;
			}
			revealtime = Random.Range(10, 30);
			if (randomtrait != 0)
			{
				traitGenerated = true;
			}
			if ((Object)(object)((Component)this).gameObject.GetComponent<FlickeringLight>() == (Object)null)
			{
				((Component)this).gameObject.AddComponent<FlickeringLight>();
				((Component)this).gameObject.GetComponent<FlickeringLight>().maxIntensity = defaultmaxintensity;
				((Component)this).gameObject.GetComponent<FlickeringLight>().minIntensity = defaultminintensity;
				((Component)this).gameObject.GetComponent<FlickeringLight>().smoothing = defaultsmoothing;
			}
		}

		public override void Update()
		{
			((FlashlightItem)this).Update();
			if (chargeonship && GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom && ((GrabbableObject)((Component)this).gameObject.GetComponent<FlashlightItem>()).insertedBattery.charge < 1f && !((GrabbableObject)this).isBeingUsed)
			{
				Battery insertedBattery = ((GrabbableObject)((Component)this).gameObject.GetComponent<FlashlightItem>()).insertedBattery;
				insertedBattery.charge += Time.deltaTime / 750f;
			}
			if (!isfaulty)
			{
				return;
			}
			if (((GrabbableObject)this).isHeld || ((GrabbableObject)this).isBeingUsed)
			{
				maintimer += Time.deltaTime;
			}
			if (!(maintimer >= revealtime) || !traitGenerated)
			{
				return;
			}
			if (randomtrait == 1)
			{
				flickertimer += Time.deltaTime;
				flickeringLightServerRpc();
			}
			if (randomtrait == 2 && !((GrabbableObject)this).isBeingUsed && ((GrabbableObject)((Component)this).gameObject.GetComponent<FlashlightItem>()).insertedBattery.charge > 0f)
			{
				Battery insertedBattery2 = ((GrabbableObject)((Component)this).gameObject.GetComponent<FlashlightItem>()).insertedBattery;
				insertedBattery2.charge -= Time.deltaTime / 350f;
			}
			if (randomtrait == 3 && ((GrabbableObject)this).isBeingUsed && ((GrabbableObject)((Component)this).gameObject.GetComponent<FlashlightItem>()).insertedBattery.charge > 0f)
			{
				Battery insertedBattery3 = ((GrabbableObject)((Component)this).gameObject.GetComponent<FlashlightItem>()).insertedBattery;
				insertedBattery3.charge -= Time.deltaTime / 200f;
			}
			if (randomtrait == 4)
			{
				if (((GrabbableObject)this).isBeingUsed)
				{
					bulbfailtimer += Time.deltaTime;
				}
				if (bulbfailtimer > randombulbfailtime && randomchance > 40f)
				{
					bulbfailures++;
					Plugin.ACALog.LogInfo((object)bulbfailures);
					bulbfailtimer = 0f;
					audiosource.pitch = Random.Range(0.8f, 1.1f);
					audiosource.PlayOneShot(bulbflicker);
					((FlashlightItem)this).SwitchFlashlight(false);
				}
			}
		}

		public override void ChargeBatteries()
		{
			((GrabbableObject)this).ChargeBatteries();
			bulbfailures = 0;
			bulbfailtimer = 0f;
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((FlashlightItem)this).ItemActivate(used, buttonDown);
			Plugin.ACALog.LogInfo((object)used);
			if (randomtrait == 5 && used && bulbfailures >= 2 && Random.Range(0, 100) > 60)
			{
				audiosource.PlayOneShot(bulbexplosion);
				((GrabbableObject)((Component)this).gameObject.GetComponent<FlashlightItem>()).insertedBattery.charge = 0f;
				dropFlashlightServerRpc();
				((FlashlightItem)this).SwitchFlashlight(false);
			}
			if (used)
			{
				randombulbfailtime = Random.Range(45f, 120f);
			}
			if (base.usingPlayerHelmetLight)
			{
				((Behaviour)playerlightsource).enabled = true;
			}
		}

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
			randomchance = Random.Range(0, 100);
			addScriptServerRpc();
			if ((!traitGenerated || randomtrait == 0) && ((NetworkBehaviour)this).IsOwner)
			{
				generateTraitServerRpc();
			}
			if (randomtrait == 4)
			{
				randomdroptime = Random.Range(120f, 240f);
			}
		}

		public override void PocketItem()
		{
			((FlashlightItem)this).PocketItem();
			((Behaviour)playerlightsource).enabled = true;
		}

		public override void DiscardItem()
		{
			((FlashlightItem)this).DiscardItem();
			((Behaviour)playerlightsource).enabled = false;
			base.previousPlayerHeldBy.helmetLight.intensity = 200f;
			flickeron = false;
		}

		[ServerRpc]
		public void generateTraitServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3193551861u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3193551861u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				generateTraitClientRpc();
			}
		}

		[ClientRpc]
		public void generateTraitClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1322574828u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1322574828u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					randomtrait = Random.Range(1, 7);
					traitGenerated = true;
					Plugin.ACALog.LogInfo((object)randomtrait);
				}
			}
		}

		[ServerRpc]
		public void dropFlashlightServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3258493582u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3258493582u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				dropFlashlightClientRpc();
			}
		}

		[ClientRpc]
		public void dropFlashlightClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(651569574u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 651569574u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					GameNetworkManager.Instance.localPlayerController.DiscardHeldObject(true, (NetworkObject)null, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position, true);
					droptimer = 0f;
				}
			}
		}

		[ServerRpc]
		public void addScriptServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2707713523u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2707713523u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				addScriptClientRpc();
			}
		}

		[ClientRpc]
		public void addScriptClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4162331778u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4162331778u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (!Object.op_Implicit((Object)(object)((Component)((GrabbableObject)this).playerHeldBy.helmetLight).gameObject.GetComponentInChildren<FlickeringLight>()))
				{
					((Component)((GrabbableObject)this).playerHeldBy.helmetLight).gameObject.AddComponent<FlickeringLight>();
				}
				playerlightsource = ((Component)((GrabbableObject)this).playerHeldBy.helmetLight).gameObject.GetComponentInChildren<FlickeringLight>();
				playerlightsource.maxIntensity = defaultmaxintensity;
				playerlightsource.minIntensity = defaultminintensity;
				playerlightsource.smoothing = defaultsmoothing;
				((Behaviour)playerlightsource).enabled = false;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void flickeringLightServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2322834690u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2322834690u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					flickeringLightClientRpc();
				}
			}
		}

		[ClientRpc]
		private void flickeringLightClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1474824981u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1474824981u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			if (!flickeron)
			{
				flickeron = true;
				flickertimebetween = Random.Range(0.5f, 2f);
				randomflickertime = Random.Range(5, 10);
			}
			else if (flickertimer >= randomflickertime)
			{
				((Component)this).gameObject.GetComponent<FlickeringLight>().maxIntensity = 40f;
				((Component)this).gameObject.GetComponent<FlickeringLight>().minIntensity = 1f;
				((Component)this).gameObject.GetComponent<FlickeringLight>().smoothing = 20;
				if (Object.op_Implicit((Object)(object)playerlightsource))
				{
					playerlightsource.maxIntensity = 40f;
					playerlightsource.minIntensity = 1f;
					playerlightsource.smoothing = 20;
				}
			}
			else
			{
				((Component)this).gameObject.GetComponent<FlickeringLight>().maxIntensity = 120f;
				((Component)this).gameObject.GetComponent<FlickeringLight>().minIntensity = 50f;
				((Component)this).gameObject.GetComponent<FlickeringLight>().smoothing = 40;
				if (Object.op_Implicit((Object)(object)playerlightsource))
				{
					playerlightsource.maxIntensity = defaultmaxintensity;
					playerlightsource.minIntensity = defaultminintensity;
					playerlightsource.smoothing = defaultsmoothing;
				}
			}
			if (flickeron && flickertimer >= randomflickertime * flickertimebetween)
			{
				flickertimer = 0f;
				flickeron = false;
			}
		}

		protected override void __initializeVariables()
		{
			((FlashlightItem)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_AbandonedFlashlightStuff()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3193551861u, new RpcReceiveHandler(__rpc_handler_3193551861));
			NetworkManager.__rpc_func_table.Add(1322574828u, new RpcReceiveHandler(__rpc_handler_1322574828));
			NetworkManager.__rpc_func_table.Add(3258493582u, new RpcReceiveHandler(__rpc_handler_3258493582));
			NetworkManager.__rpc_func_table.Add(651569574u, new RpcReceiveHandler(__rpc_handler_651569574));
			NetworkManager.__rpc_func_table.Add(2707713523u, new RpcReceiveHandler(__rpc_handler_2707713523));
			NetworkManager.__rpc_func_table.Add(4162331778u, new RpcReceiveHandler(__rpc_handler_4162331778));
			NetworkManager.__rpc_func_table.Add(2322834690u, new RpcReceiveHandler(__rpc_handler_2322834690));
			NetworkManager.__rpc_func_table.Add(1474824981u, new RpcReceiveHandler(__rpc_handler_1474824981));
		}

		private static void __rpc_handler_3193551861(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AbandonedFlashlightStuff)(object)target).generateTraitServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1322574828(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AbandonedFlashlightStuff)(object)target).generateTraitClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3258493582(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AbandonedFlashlightStuff)(object)target).dropFlashlightServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_651569574(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AbandonedFlashlightStuff)(object)target).dropFlashlightClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2707713523(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AbandonedFlashlightStuff)(object)target).addScriptServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4162331778(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AbandonedFlashlightStuff)(object)target).addScriptClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2322834690(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AbandonedFlashlightStuff)(object)target).flickeringLightServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1474824981(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AbandonedFlashlightStuff)(object)target).flickeringLightClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "AbandonedFlashlightStuff";
		}
	}
	internal class AbandonedWalkieStuff : WalkieTalkie
	{
		private int randomtrait;

		private bool traitGenerated;

		public bool isfaulty = true;

		private float powertimer;

		private float randompowerofftime;

		private float randomgarbletime;

		private float stoprandomgarble;

		private bool gentimers;

		private float maintimer;

		private float revealtime;

		private float garbletimer;

		public override void LoadItemSaveData(int saveData)
		{
			((GrabbableObject)this).LoadItemSaveData(saveData);
			Plugin.ACALog.LogInfo((object)("Load Data:" + saveData));
			randomtrait = saveData;
		}

		public override int GetItemDataToSave()
		{
			((GrabbableObject)this).GetItemDataToSave();
			Plugin.ACALog.LogInfo((object)("Save Data:" + randomtrait));
			return randomtrait;
		}

		public override void Start()
		{
			((WalkieTalkie)this).Start();
			revealtime = Random.Range(60, 90);
			randompowerofftime = Random.Range(180f, 360f);
			randomgarbletime = Random.Range(60f, 180f);
			stoprandomgarble = Random.Range(10f, 30f);
			((GrabbableObject)((Component)this).gameObject.GetComponent<WalkieTalkie>()).insertedBattery.charge = Random.Range(0.3f, 0.8f);
		}

		public override void Update()
		{
			((WalkieTalkie)this).Update();
			if (!isfaulty)
			{
				return;
			}
			if (((GrabbableObject)this).isHeld || ((GrabbableObject)this).isBeingUsed)
			{
				maintimer += Time.deltaTime;
				if (randomtrait == 3 || randomtrait == 5)
				{
					powertimer += Time.deltaTime;
				}
			}
			if (!(maintimer >= revealtime) || !traitGenerated)
			{
				return;
			}
			if (randomtrait == 1)
			{
				if ((Object)(object)((Component)this).gameObject.GetComponent<AudioDistortionFilter>() != (Object)null)
				{
					((Component)this).gameObject.GetComponent<AudioDistortionFilter>().distortionLevel = 0.7f;
				}
				else if (((NetworkBehaviour)this).IsOwner)
				{
					generateTraitServerRpc();
				}
			}
			if (randomtrait == 2 && ((GrabbableObject)this).isBeingUsed)
			{
				Battery insertedBattery = ((GrabbableObject)((Component)this).gameObject.GetComponent<WalkieTalkie>()).insertedBattery;
				insertedBattery.charge -= Time.deltaTime / 200f;
			}
			if (randomtrait == 4 && powertimer >= randompowerofftime)
			{
				((WalkieTalkie)this).SwitchWalkieTalkieOn(false);
				powertimer = 0f;
			}
			if (randomtrait == 5)
			{
				if (powertimer >= randomgarbletime)
				{
					base.playingGarbledVoice = true;
					garbletimer += Time.deltaTime;
				}
				if (garbletimer >= stoprandomgarble)
				{
					base.playingGarbledVoice = false;
					powertimer = 0f;
					garbletimer = 0f;
				}
			}
			if (randomtrait == 6 && !((GrabbableObject)this).isBeingUsed && ((GrabbableObject)((Component)this).gameObject.GetComponent<WalkieTalkie>()).insertedBattery.charge > 0f)
			{
				Battery insertedBattery2 = ((GrabbableObject)((Component)this).gameObject.GetComponent<WalkieTalkie>()).insertedBattery;
				insertedBattery2.charge -= Time.deltaTime / 350f;
			}
		}

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
			if ((!traitGenerated || randomtrait == 0) && ((NetworkBehaviour)this).IsOwner)
			{
				generateTraitServerRpc();
			}
		}

		public override void ChargeBatteries()
		{
			((GrabbableObject)this).ChargeBatteries();
			if (randomtrait == 3)
			{
				((GrabbableObject)((Component)this).gameObject.GetComponent<WalkieTalkie>()).insertedBattery.charge = 0.5f;
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((WalkieTalkie)this).ItemActivate(used, buttonDown);
		}

		[ServerRpc]
		public void generateTraitServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(803570656u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 803570656u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				generateTraitClientRpc();
			}
		}

		[ClientRpc]
		public void generateTraitClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(180780237u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 180780237u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					randomtrait = Random.Range(1, 7);
					traitGenerated = true;
					Plugin.ACALog.LogInfo((object)randomtrait);
				}
			}
		}

		protected override void __initializeVariables()
		{
			((WalkieTalkie)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_AbandonedWalkieStuff()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(803570656u, new RpcReceiveHandler(__rpc_handler_803570656));
			NetworkManager.__rpc_func_table.Add(180780237u, new RpcReceiveHandler(__rpc_handler_180780237));
		}

		private static void __rpc_handler_803570656(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AbandonedWalkieStuff)(object)target).generateTraitServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_180780237(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AbandonedWalkieStuff)(object)target).generateTraitClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "AbandonedWalkieStuff";
		}
	}
	internal class CandleStuff : GrabbableObject
	{
		private ParticleSystem particles;

		private Light lighting;

		private AudioSource audioSource;

		private PlayerControllerB player;

		public AudioClip flame;

		public AudioClip lightFlame;

		public AudioClip blowFlame;

		public PlayerControllerB currentPlayer;

		private int failNumber = Random.Range(minFail, maxFail);

		private int failCount;

		private int totalFailCount;

		public static int minFail;

		public static int maxFail;

		private bool currentlyLit;

		public float defaultLightIntensity;

		public float defaultLightRange;

		public float randomFailTimeMax;

		private float randomFailTime;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			failNumber = Random.Range(minFail, maxFail);
			particles = ((Component)this).GetComponentInChildren<ParticleSystem>();
			lighting = ((Component)this).GetComponentInChildren<Light>();
			audioSource = ((Component)this).GetComponentInChildren<AudioSource>();
			particles.Stop();
			particles.Clear();
			if ((Object)(object)particles == (Object)null)
			{
				Plugin.ACALog.LogDebug((object)"WHERE THE FUCK ARE MY PARTICLES");
			}
			if ((Object)(object)lighting == (Object)null)
			{
				Plugin.ACALog.LogDebug((object)"WHERE THE FUCK ARE MY PARTICLES");
			}
		}

		public override int GetItemDataToSave()
		{
			((GrabbableObject)this).GetItemDataToSave();
			short num = (short)failNumber;
			short num2 = (short)totalFailCount;
			return (num << 16) | (num2 & 0xFFFF);
		}

		public override void LoadItemSaveData(int saveData)
		{
			((GrabbableObject)this).LoadItemSaveData(saveData);
			short num = (short)(saveData >> 16);
			short num2 = (short)(saveData & 0xFFFF);
			failNumber = num;
			totalFailCount = num2;
			saveData = 0;
		}

		public override void Update()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Invalid comparison between Unknown and I4
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Invalid comparison between Unknown and I4
			((GrabbableObject)this).Update();
			if (((int)RoundManager.Instance.currentLevel.currentWeather == 1 || (int)RoundManager.Instance.currentLevel.currentWeather == 4 || GameNetworkManager.Instance.localPlayerController.isUnderwater) && !GameNetworkManager.Instance.localPlayerController.isInsideFactory && !GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom && currentlyLit)
			{
				totalFailCount++;
				lightCandle(grabbing: false, freshCandle: false);
			}
			if (currentlyLit)
			{
				if (randomFailTimeMax == 0f && totalFailCount < failNumber)
				{
					randomFailTimeMax = Random.Range(90f, 220f);
				}
				else if (totalFailCount < failNumber)
				{
					randomFailTime += Time.deltaTime;
				}
				if (randomFailTime > randomFailTimeMax)
				{
					if (Random.Range(0, 100) > 60)
					{
						particles.Stop();
						particles.Clear();
						candleStart(startCandle: false);
						lightCandle(grabbing: false, freshCandle: false);
						randomFailTime = 0f;
					}
					else
					{
						randomFailTime /= 2f;
					}
				}
			}
			if (currentlyLit)
			{
				if (lighting.range < defaultLightRange)
				{
					Light obj = lighting;
					obj.range += Time.deltaTime * 3f;
				}
			}
			else if (lighting.range > 0f)
			{
				Light obj2 = lighting;
				obj2.range -= Time.deltaTime * 10f;
			}
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			if (currentlyLit)
			{
				particles.Play();
				candleStart(startCandle: true);
			}
			else
			{
				particles.Stop();
				particles.Clear();
				candleStart(startCandle: false);
			}
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			if (currentlyLit)
			{
				audioSource.pitch = Random.Range(0.9f, 1.1f);
				audioSource.PlayOneShot(blowFlame);
				particles.Stop();
				particles.Clear();
				candleStart(startCandle: false);
				lightCandle(grabbing: false, freshCandle: false);
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Invalid comparison between Unknown and I4
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if ((int)RoundManager.Instance.currentLevel.currentWeather == 1 || (int)RoundManager.Instance.currentLevel.currentWeather == 4)
			{
				if (!GameNetworkManager.Instance.localPlayerController.isInsideFactory && !GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom)
				{
					totalFailCount++;
					audioSource.pitch = Random.Range(0.4f, 0.6f);
					audioSource.PlayOneShot(blowFlame);
				}
				else
				{
					lightCandle(grabbing: false, freshCandle: false);
				}
			}
			Plugin.ACALog.LogInfo((object)"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
			if ((int)RoundManager.Instance.currentLevel.currentWeather != 1)
			{
				lightCandle(grabbing: false, freshCandle: false);
			}
		}

		private void candleStart(bool startCandle)
		{
			if (startCandle)
			{
				audioSource.clip = flame;
				audioSource.pitch = Random.Range(0.9f, 1.1f);
				audioSource.loop = true;
				audioSource.Play();
			}
			else
			{
				audioSource.Stop();
			}
		}

		public void lightCandle(bool grabbing, bool freshCandle)
		{
			currentPlayer = GameNetworkManager.Instance.localPlayerController;
			int num = (int)currentPlayer.insanityLevel / 2;
			int num2 = Random.Range(1, 100);
			int num3 = Random.Range(1, 100 - num);
			if (currentPlayer.insanityLevel >= 15f && (double)num2 >= (double)num3 * 3.5 && !grabbing && !currentlyLit && totalFailCount < failNumber && !freshCandle)
			{
				failCount++;
				totalFailCount++;
				particles.Stop();
				particles.Clear();
				candleStart(startCandle: false);
				audioSource.pitch = Random.Range(0.4f, 0.6f);
				audioSource.PlayOneShot(blowFlame);
				candleIsLitServerRpc(lit: false, deadCandle: false);
			}
			else if (!currentlyLit && totalFailCount < failNumber && !freshCandle)
			{
				particles.Play();
				candleStart(startCandle: true);
				audioSource.pitch = Random.Range(0.9f, 1.1f);
				audioSource.PlayOneShot(lightFlame);
				failCount = 0;
				candleIsLitServerRpc(lit: true, deadCandle: false);
			}
			else if (totalFailCount < failNumber)
			{
				particles.Stop();
				candleStart(startCandle: false);
				audioSource.pitch = Random.Range(0.9f, 1.1f);
				audioSource.PlayOneShot(blowFlame);
				candleIsLitServerRpc(lit: false, deadCandle: false);
			}
			else
			{
				particles.Stop();
				candleStart(startCandle: false);
				candleIsLitServerRpc(lit: false, deadCandle: true);
			}
		}

		[ServerRpc]
		private void candleIsLitServerRpc(bool lit, bool deadCandle)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2351022155u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref lit, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref deadCandle, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2351022155u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				candleIsLitClientRpc(lit, !deadCandle);
				if (deadCandle)
				{
					candleIsLitClientRpc(lit: false, deadCandle: true);
				}
			}
		}

		[ClientRpc]
		private void candleIsLitClientRpc(bool lit, bool deadCandle)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(207752887u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref lit, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref deadCandle, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 207752887u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (lit)
				{
					currentlyLit = true;
				}
				else
				{
					currentlyLit = false;
				}
			}
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_CandleStuff()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2351022155u, new RpcReceiveHandler(__rpc_handler_2351022155));
			NetworkManager.__rpc_func_table.Add(207752887u, new RpcReceiveHandler(__rpc_handler_207752887));
		}

		private static void __rpc_handler_2351022155(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				bool lit = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref lit, default(ForPrimitives));
				bool deadCandle = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref deadCandle, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CandleStuff)(object)target).candleIsLitServerRpc(lit, deadCandle);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_207752887(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool lit = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref lit, default(ForPrimitives));
				bool deadCandle = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref deadCandle, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((CandleStuff)(object)target).candleIsLitClientRpc(lit, deadCandle);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "CandleStuff";
		}
	}
	internal class GlowstickStuff : GrabbableObject
	{
		public PlayerControllerB currentPlayer;

		private int currentState;

		public Light lighting;

		public AudioClip glowstickSnap;

		public bool droppedStick;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			((Component)this).GetComponentInChildren<GrabbableObject>().insertedBattery.charge = 560f;
			lighting = ((Component)this).GetComponentInChildren<Light>();
			Plugin.ACALog.LogInfo((object)"Glowstick Spawned.");
			((GrabbableObject)this).EnablePhysics(true);
			((GrabbableObject)this).EnableItemMeshes(true);
		}

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if (droppedStick)
			{
				Battery insertedBattery = ((Component)this).GetComponentInChildren<GrabbableObject>().insertedBattery;
				insertedBattery.charge -= Time.deltaTime % 60f;
				if (((Component)this).GetComponentInChildren<GrabbableObject>().insertedBattery.charge < 3f)
				{
					glowstickDieServerRpc();
					if ((double)lighting.range > 0.05)
					{
						((Collider)((Component)this).GetComponentInChildren<BoxCollider>()).enabled = false;
					}
				}
			}
			if (!RoundManager.Instance.begunSpawningEnemies && droppedStick && ((Component)this).gameObject.GetComponentInChildren<NetworkObject>().IsOwner)
			{
				deleteSticksServerRpc();
			}
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			isGlowstickLitServerRpc(lit: false);
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			isGlowstickLitServerRpc(lit: true);
		}

		public override int GetItemDataToSave()
		{
			((GrabbableObject)this).GetItemDataToSave();
			Plugin.ACALog.LogInfo((object)("Save Data:" + currentState));
			return currentState;
		}

		public override void LoadItemSaveData(int saveData)
		{
			((GrabbableObject)this).LoadItemSaveData(saveData);
			currentState = saveData;
			Plugin.ACALog.LogInfo((object)("Load Data:" + saveData));
			for (int i = 0; i < currentState; i++)
			{
				((Component)((Component)this).gameObject.transform.GetChild(i)).gameObject.SetActive(false);
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			Plugin.ACALog.LogInfo((object)currentState);
			Plugin.ACALog.LogInfo((object)Plugin.GlowstickDroppedItem.spawnPrefab.gameObject);
			Plugin.ACALog.LogInfo((object)((NetworkBehaviour)this).OwnerClientId);
			currentState++;
			Plugin.ACALog.LogInfo((object)"Glowstick Used.");
			if (!droppedStick)
			{
				GlowstickSpawnServerRpc(((Component)this).gameObject.transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.rotation);
			}
		}

		[ServerRpc]
		private void deleteSticksServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(734536924u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 734536924u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((Component)this).gameObject.GetComponent<NetworkObject>().ChangeOwnership(((NetworkBehaviour)this).OwnerClientId);
				deleteClientRpc();
			}
		}

		[ClientRpc]
		private void deleteClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3677327553u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3677327553u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((Component)this).gameObject.GetComponentInChildren<NetworkObject>().IsOwner)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}
		}

		[ServerRpc]
		private void GlowstickSpawnServerRpc(Vector3 position, Quaternion rotation)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Invalid comparison between Unknown and I4
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: 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: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1423229295u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref rotation);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1423229295u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				GlowstickStackClientRpc();
				GameObject val3 = Object.Instantiate<GameObject>(Plugin.GlowstickDroppedItem.spawnPrefab.gameObject, position, rotation, StartOfRound.Instance.propsContainer);
				val3.GetComponent<NetworkObject>().SpawnWithOwnership(((NetworkBehaviour)this).OwnerClientId, false);
				if (currentState < 3)
				{
					val3.GetComponent<NetworkObject>().ChangeOwnership(((NetworkBehaviour)this).OwnerClientId);
					val3.GetComponentInChildren<AudioSource>().pitch = Random.Range(0.9f, 1.1f);
					val3.GetComponentInChildren<AudioSource>().PlayOneShot(glowstickSnap);
					val3.GetComponentInChildren<GrabbableObject>().grabbable = false;
				}
			}
		}

		[ServerRpc]
		private void isGlowstickLitServerRpc(bool lit)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1054161706u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref lit, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1054161706u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				isGlowstickLitClientRpc(lit);
			}
		}

		[ClientRpc]
		private void isGlowstickLitClientRpc(bool lit)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(402954236u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref lit, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 402954236u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (lit)
				{
					((Behaviour)lighting).enabled = true;
				}
				else
				{
					((Behaviour)lighting).enabled = false;
				}
			}
		}

		[ServerRpc]
		private void glowstickDieServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3923035235u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3923035235u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				glowstickDieClientRpc();
			}
		}

		[ClientRpc]
		private void glowstickDieClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2386388057u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2386388057u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Light obj = lighting;
					obj.intensity -= Time.deltaTime * 3f;
					Light obj2 = lighting;
					obj2.range -= Time.deltaTime * 3f;
				}
			}
		}

		[ClientRpc]
		private void GlowstickStackClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(211096720u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 211096720u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				((Component)((Component)this).gameObject.transform.GetChild(currentState)).gameObject.SetActive(false);
				if (currentState == 3)
				{
					base.playerHeldBy.DestroyItemInSlotAndSync(base.playerHeldBy.currentItemSlot);
				}
			}
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_GlowstickStuff()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(734536924u, new RpcReceiveHandler(__rpc_handler_734536924));
			NetworkManager.__rpc_func_table.Add(3677327553u, new RpcReceiveHandler(__rpc_handler_3677327553));
			NetworkManager.__rpc_func_table.Add(1423229295u, new RpcReceiveHandler(__rpc_handler_1423229295));
			NetworkManager.__rpc_func_table.Add(1054161706u, new RpcReceiveHandler(__rpc_handler_1054161706));
			NetworkManager.__rpc_func_table.Add(402954236u, new RpcReceiveHandler(__rpc_handler_402954236));
			NetworkManager.__rpc_func_table.Add(3923035235u, new RpcReceiveHandler(__rpc_handler_3923035235));
			NetworkManager.__rpc_func_table.Add(2386388057u, new RpcReceiveHandler(__rpc_handler_2386388057));
			NetworkManager.__rpc_func_table.Add(211096720u, new RpcReceiveHandler(__rpc_handler_211096720));
		}

		private static void __rpc_handler_734536924(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((GlowstickStuff)(object)target).deleteSticksServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3677327553(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((GlowstickStuff)(object)target).deleteClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1423229295(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_00ae: 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_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				Quaternion rotation = default(Quaternion);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref rotation);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((GlowstickStuff)(object)target).GlowstickSpawnServerRpc(position, rotation);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1054161706(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				bool lit = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref lit, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((GlowstickStuff)(object)target).isGlowstickLitServerRpc(lit);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_402954236(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool lit = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref lit, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((GlowstickStuff)(object)target).isGlowstickLitClientRpc(lit);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3923035235(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((GlowstickStuff)(object)target).glowstickDieServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2386388057(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((GlowstickStuff)(object)target).glowstickDieClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_211096720(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((GlowstickStuff)(object)target).GlowstickStackClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "GlowstickStuff";
		}
	}
	internal class lighterStuff : GrabbableObject
	{
		private Light lighting;

		private ParticleSystem flame;

		private AudioSource audiosource;

		public AudioClip lighterflick;

		public AudioClip burningflame;

		public AudioClip lighterclose;

		public float fuel;

		private int currentstate;

		private float timerdelay;

		private bool lighterlit;

		private float savedfuel;

		private bool lighterdead;

		private bool pocketingitem;

		public bool usesfueltowebburn;

		public bool getsextrafuel;

		public override void LoadItemSaveData(int saveData)
		{
			((GrabbableObject)this).LoadItemSaveData(saveData);
			Plugin.ACALog.LogInfo((object)("Load Data:" + saveData));
			fuel = saveData;
			if (saveData <= 0)
			{
				lighterdead = true;
			}
			else if (saveData > 0)
			{
				savedfuel = saveData;
			}
		}

		public override int GetItemDataToSave()
		{
			((GrabbableObject)this).GetItemDataToSave();
			Plugin.ACALog.LogInfo((object)("Save Data:" + (int)Mathf.Round(fuel)));
			return (int)Mathf.Round(fuel);
		}

		public override void Start()
		{
			((GrabbableObject)this).Start();
			lighting = ((Component)this).GetComponentInChildren<Light>();
			flame = ((Component)this).GetComponentInChildren<ParticleSystem>();
			audiosource = ((Component)this).GetComponentInChildren<AudioSource>();
			((Component)this).GetComponentInChildren<GrabbableObject>().insertedBattery.charge = fuel;
			if (savedfuel < 0f)
			{
				fuel = savedfuel;
			}
			else if (!lighterdead)
			{
				if (getsextrafuel)
				{
					fuel = Random.Range(500, 2000);
				}
				else
				{
					fuel = Random.Range(300, 1500);
				}
			}
			if (((NetworkBehaviour)this).IsOwnedByServer)
			{
				lighterServerRpc();
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			SwitchStateServerRpc();
			timerdelay = 0f;
			if (((NetworkBehaviour)this).IsOwner)
			{
				lighterServerRpc();
			}
			Plugin.ACALog.LogInfo((object)currentstate);
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			if (currentstate == 1)
			{
				pocketingitem = true;
				timerdelay = 0f;
				currentstate = 0;
				lighterlit = false;
				if (((NetworkBehaviour)this).IsOwner)
				{
					lighterServerRpc();
				}
			}
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			if (pocketingitem)
			{
				currentstate = 1;
				pocketingitem = false;
				if (((NetworkBehaviour)this).IsOwner)
				{
					lighterServerRpc();
				}
			}
		}

		public override void Update()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Update();
			if (base.isHeld && GameNetworkManager.Instance.localPlayerController.isUnderwater && !lighterdead)
			{
				lighterDeadServerRpc();
				currentstate = 0;
			}
			Collider[] array = Physics.OverlapSphere(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, 2f, 2097152);
			if (currentstate == 1 && lighterlit && !lighterdead)
			{
				Collider[] array2 = array;
				foreach (Collider val in array2)
				{
					if (((Object)((Component)val).gameObject).name == "WebContainer")
					{
						SandSpiderWebTrap component = ((Component)val).gameObject.GetComponent<SandSpiderWebTrap>();
						if (((NetworkBehaviour)this).IsHost && (Object)(object)component != (Object)null)
						{
							component.mainScript.BreakWebClientRpc(((Component)component).transform.position, component.trapID);
						}
						else if ((Object)(object)component != (Object)null)
						{
							component.mainScript.BreakWebServerRpc(component.trapID, (int)GameNetworkManager.Instance.localPlayerController.playerClientId);
						}
						if (((NetworkBehaviour)this).IsOwner)
						{
							fireSpawnServerRpc(component.centerOfWeb.position);
						}
						if (usesfueltowebburn)
						{
							fuel -= Random.Range(30, 60);
						}
					}
				}
			}
			if (currentstate == 1 && !pocketingitem)
			{
				timerdelay += Time.deltaTime;
				if (!lighterdead)
				{
					fuel -= Time.deltaTime;
				}
			}
			if ((double)timerdelay > 0.9 && currentstate == 1)
			{
				if (((NetworkBehaviour)this).IsOwner)
				{
					lighterOnServerRpc();
				}
				lighterlit = true;
			}
			if (fuel <= 0f && !lighterdead)
			{
				currentstate = 0;
				if (((NetworkBehaviour)this).IsOwner)
				{
					lighterDeadServerRpc();
					lighterServerRpc();
				}
			}
		}

		[ServerRpc]
		private void lighterOnServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_007a: Unknown result type (might be due to invalid IL or missing referenc