Decompiled source of abandonedcompanyassetsfork v0.16.0

AbandonedCompanyAssets.dll

Decompiled 2 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;
using AbandonedCompanyAssets.Behaviours;
using AbandonedCompanyAssets.NetcodePatcher;
using AbandonedCompanyAssets.itemStuff;
using BepInEx;
using BepInEx.Logging;
using Dawn;
using Dusk;
using Dusk.Weights;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("AbandonedCompanyAssets")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Find abandoned company assets.")]
[assembly: AssemblyFileVersion("0.16.0.0")]
[assembly: AssemblyInformationalVersion("0.16.0")]
[assembly: AssemblyProduct("AbandonedCompanyAssets")]
[assembly: AssemblyTitle("AbandonedCompanyAssets")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.16.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
internal static class GlowstickNetwork
{
	[CompilerGenerated]
	private static class <>O
	{
		public static HandleNamedMessageDelegate <0>__OnRequest;

		public static HandleNamedMessageDelegate <1>__OnSpawn;
	}

	private const string RequestMsg = "Glowstick_Request";

	private const string SpawnMsg = "Glowstick_Spawn";

	private static bool wired;

	public static void EnsureWired()
	{
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Expected O, but got Unknown
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Expected O, but got Unknown
		if (wired)
		{
			return;
		}
		NetworkManager singleton = NetworkManager.Singleton;
		if ((Object)(object)singleton == (Object)null)
		{
			return;
		}
		CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager;
		if (customMessagingManager != null)
		{
			object obj = <>O.<0>__OnRequest;
			if (obj == null)
			{
				HandleNamedMessageDelegate val = OnRequest;
				<>O.<0>__OnRequest = val;
				obj = (object)val;
			}
			customMessagingManager.RegisterNamedMessageHandler("Glowstick_Request", (HandleNamedMessageDelegate)obj);
			object obj2 = <>O.<1>__OnSpawn;
			if (obj2 == null)
			{
				HandleNamedMessageDelegate val2 = OnSpawn;
				<>O.<1>__OnSpawn = val2;
				obj2 = (object)val2;
			}
			customMessagingManager.RegisterNamedMessageHandler("Glowstick_Spawn", (HandleNamedMessageDelegate)obj2);
			wired = true;
		}
	}

	public static void SendRequest(Vector3 pos, Quaternion rot)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager singleton = NetworkManager.Singleton;
		if ((Object)(object)singleton == (Object)null)
		{
			return;
		}
		CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager;
		FastBufferWriter val = default(FastBufferWriter);
		((FastBufferWriter)(ref val))..ctor(64, (Allocator)2, -1);
		try
		{
			((FastBufferWriter)(ref val)).WriteValueSafe(ref pos);
			((FastBufferWriter)(ref val)).WriteValueSafe(ref rot);
			customMessagingManager.SendNamedMessage("Glowstick_Request", 0uL, val, (NetworkDelivery)2);
		}
		finally
		{
			((IDisposable)(FastBufferWriter)(ref val)).Dispose();
		}
	}

	private static void OnRequest(ulong sender, FastBufferReader reader)
	{
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager singleton = NetworkManager.Singleton;
		if ((Object)(object)singleton == (Object)null || !singleton.IsServer)
		{
			return;
		}
		Vector3 val = default(Vector3);
		((FastBufferReader)(ref reader)).ReadValueSafe(ref val);
		Quaternion val2 = default(Quaternion);
		((FastBufferReader)(ref reader)).ReadValueSafe(ref val2);
		CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager;
		FastBufferWriter val3 = default(FastBufferWriter);
		((FastBufferWriter)(ref val3))..ctor(64, (Allocator)2, -1);
		try
		{
			((FastBufferWriter)(ref val3)).WriteValueSafe(ref val);
			((FastBufferWriter)(ref val3)).WriteValueSafe(ref val2);
			customMessagingManager.SendNamedMessageToAll("Glowstick_Spawn", val3, (NetworkDelivery)2);
		}
		finally
		{
			((IDisposable)(FastBufferWriter)(ref val3)).Dispose();
		}
	}

	private static void OnSpawn(ulong sender, FastBufferReader reader)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		Vector3 pos = default(Vector3);
		((FastBufferReader)(ref reader)).ReadValueSafe(ref pos);
		Quaternion rot = default(Quaternion);
		((FastBufferReader)(ref reader)).ReadValueSafe(ref rot);
		SpawnLocal(pos, rot);
	}

	public static void SpawnLocal(Vector3 pos, Quaternion rot)
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: 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)
		StartOfRound instance = StartOfRound.Instance;
		if (!((Object)(object)instance == (Object)null))
		{
			GameObject val = Object.Instantiate<GameObject>(Plugin.GlowstickDroppedItem.spawnPrefab);
			val.transform.SetParent((Transform)null);
			val.transform.position = pos + Vector3.up * 0.2f;
			val.transform.rotation = rot;
			Rigidbody val2 = val.GetComponent<Rigidbody>();
			if ((Object)(object)val2 == (Object)null)
			{
				val2 = val.AddComponent<Rigidbody>();
			}
			val2.useGravity = true;
			val2.isKinematic = false;
			val2.mass = 0.15f;
			val2.collisionDetectionMode = (CollisionDetectionMode)2;
			Collider component = val.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			BoxCollider val3 = val.AddComponent<BoxCollider>();
			val3.size = new Vector3(0.05f, 0.05f, 0.3f);
			val3.center = Vector3.zero;
			((Collider)val3).isTrigger = false;
			val.SetActive(true);
		}
	}

	public static void Reset()
	{
		wired = false;
	}
}
[HarmonyPatch(typeof(StartOfRound), "Awake")]
internal static class ResetGlowstickNetwork
{
	private static void Postfix()
	{
		GlowstickNetwork.Reset();
	}
}
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);
	}
	internal static class DawnItemKeys
	{
		public static readonly NamespacedKey<DawnItemInfo> Candle = NamespacedKey<DawnItemInfo>.From("abandoned_company_assets", "candle");

		public static readonly NamespacedKey<DawnItemInfo> GlowstickShop = NamespacedKey<DawnItemInfo>.From("abandoned_company_assets", "glowstick_shop");

		public static readonly NamespacedKey<DawnItemInfo> GlowstickDropped = NamespacedKey<DawnItemInfo>.From("abandoned_company_assets", "glowstick_dropped");

		public static readonly NamespacedKey<DawnItemInfo> Lighter = NamespacedKey<DawnItemInfo>.From("abandoned_company_assets", "lighter");

		public static readonly NamespacedKey<DawnItemInfo> BulletLighter = NamespacedKey<DawnItemInfo>.From("abandoned_company_assets", "bullet_lighter");

		public static readonly NamespacedKey<DawnItemInfo> SignalFlare = NamespacedKey<DawnItemInfo>.From("abandoned_company_assets", "signal_flare");

		public static readonly NamespacedKey<DawnItemInfo> AbandonedFlashlight = NamespacedKey<DawnItemInfo>.From("abandoned_company_assets", "abandoned_flashlight");

		public static readonly NamespacedKey<DawnItemInfo> ProAbandonedFlashlight = NamespacedKey<DawnItemInfo>.From("abandoned_company_assets", "pro_abandoned_flashlight");

		public static readonly NamespacedKey<DawnItemInfo> AbandonedTzp = NamespacedKey<DawnItemInfo>.From("abandoned_company_assets", "abandoned_tzp");
	}
	[BepInPlugin("AbandonedCompanyAssets", "AbandonedCompanyAssets", "0.16.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private static Harmony harmony;

		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 proabaondedflashlightitem = assetCall.bundle.LoadAsset<Item>("Assets/Items/proflashlight/ProAbandonedFlashlight.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;

		internal static int GlowstickUses = 3;

		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 EnableProAbandonedFlashlight = 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 AbandonedTZPSpawnWeight = 60;

		private static int DroppedGlowstickSpawnWeight = 10;

		public void Awake()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			instance = this;
			harmony = new Harmony("AbandonedCompanyAssets");
			ACALog = ((BaseUnityPlugin)this).Logger;
			loadConfig();
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			DawnLib.RegisterNetworkPrefab(candle.spawnPrefab);
			DawnLib.RegisterNetworkPrefab(glowstick.spawnPrefab);
			DawnLib.RegisterNetworkPrefab(GlowstickDroppedItem.spawnPrefab);
			DawnLib.RegisterNetworkPrefab(lighter.spawnPrefab);
			DawnLib.RegisterNetworkPrefab(webBurnParticles);
			DawnLib.RegisterNetworkPrefab(bulletLighter.spawnPrefab);
			DawnLib.RegisterNetworkPrefab(signalFlareItem.spawnPrefab);
			DawnLib.RegisterNetworkPrefab(signalFlareParticles);
			DawnLib.RegisterNetworkPrefab(abandonedflashlightitem.spawnPrefab);
			DawnLib.RegisterNetworkPrefab(proabaondedflashlightitem.spawnPrefab);
			DawnLib.RegisterNetworkPrefab(abandonedTZPItem.spawnPrefab);
			DawnLib.FixMixerGroups(candle.spawnPrefab);
			DawnLib.FixMixerGroups(GlowstickDroppedItem.spawnPrefab);
			DawnLib.FixMixerGroups(glowstick.spawnPrefab);
			DawnLib.FixMixerGroups(lighter.spawnPrefab);
			DawnLib.FixMixerGroups(bulletLighter.spawnPrefab);
			DawnLib.FixMixerGroups(signalFlareItem.spawnPrefab);
			DawnLib.FixMixerGroups(webBurnParticles);
			DawnLib.FixMixerGroups(signalFlareParticles);
			DawnLib.FixMixerGroups(abandonedflashlightitem.spawnPrefab);
			DawnLib.FixMixerGroups(proabaondedflashlightitem.spawnPrefab);
			DawnLib.FixMixerGroups(abandonedTZPItem.spawnPrefab);
			if (FlareCompatName)
			{
				signalFlareItem.itemName = "Military Flare";
			}
			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";
			RegisterDawnItems(val);
			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;
			harmony.PatchAll(typeof(ResetGlowstickNetwork));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin AbandonedCompanyAssets is loaded!");
		}

		private SpawnWeightsPreset CreateGlobalWeightPreset(int baseWeight)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			SpawnWeightsPreset val = new SpawnWeightsPreset();
			List<NamespacedConfigWeight> list = new List<NamespacedConfigWeight>();
			List<NamespacedConfigWeight> list2 = new List<NamespacedConfigWeight>();
			List<NamespacedConfigWeight> list3 = new List<NamespacedConfigWeight>();
			val.SetupSpawnWeightsPreset(list, list2, list3, baseWeight);
			return val;
		}

		private void RegisterDawnItems(TerminalNode candleInfoNode)
		{
			if (EnableDungeonCandle || EnableShopCandle)
			{
				DawnLib.DefineItem(DawnItemKeys.Candle, candle, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
				{
					if (EnableDungeonCandle)
					{
						builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
						{
							scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
							{
								weightBuilder.SetGlobalWeight((IWeighted)(object)CreateGlobalWeightPreset(CandleSpawnWeight));
							});
						});
					}
					if (EnableShopCandle)
					{
						builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder)
						{
							shopBuilder.OverrideCost(7);
							shopBuilder.OverrideInfoNode(candleInfoNode);
						});
					}
				});
			}
			if (EnableGlowsticks)
			{
				DawnLib.DefineItem(DawnItemKeys.GlowstickDropped, GlowstickDroppedItem, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
				{
					builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
					{
						scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
						{
							weightBuilder.SetGlobalWeight((IWeighted)(object)CreateGlobalWeightPreset(DroppedGlowstickSpawnWeight));
						});
					});
				});
			}
			if (EnableRandomGlowsticks)
			{
				DawnLib.DefineItem(DawnItemKeys.GlowstickShop, glowstick, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
				{
					builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder)
					{
						shopBuilder.OverrideCost(15);
					});
				});
			}
			if (EnableLighter)
			{
				DawnLib.DefineItem(DawnItemKeys.Lighter, lighter, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
				{
					builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
					{
						scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
						{
							weightBuilder.SetGlobalWeight((IWeighted)(object)CreateGlobalWeightPreset(LighterSpawnWeight));
						});
					});
				});
				DawnLib.DefineItem(DawnItemKeys.BulletLighter, bulletLighter, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
				{
					builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
					{
						scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
						{
							weightBuilder.SetGlobalWeight((IWeighted)(object)CreateGlobalWeightPreset(BulletLighterSpawnWeight));
						});
					});
				});
			}
			if (EnableAbandonedFlashlight)
			{
				DawnLib.DefineItem(DawnItemKeys.AbandonedFlashlight, abandonedflashlightitem, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
				{
					builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
					{
						scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
						{
							weightBuilder.SetGlobalWeight((IWeighted)(object)CreateGlobalWeightPreset(AbandonedBBFlashSpawnWeight));
						});
					});
				});
			}
			if (EnableProAbandonedFlashlight)
			{
				DawnLib.DefineItem(DawnItemKeys.ProAbandonedFlashlight, proabaondedflashlightitem, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
				{
					builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
					{
						scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
						{
							weightBuilder.SetGlobalWeight((IWeighted)(object)CreateGlobalWeightPreset(AbandonedProFlashSpawnWeight));
						});
					});
				});
			}
			if (EnableAbandonedTZP)
			{
				DawnLib.DefineItem(DawnItemKeys.AbandonedTzp, abandonedTZPItem, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
				{
					builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
					{
						scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo>>)delegate(WeightTableBuilder<DawnMoonInfo> weightBuilder)
						{
							weightBuilder.SetGlobalWeight((IWeighted)(object)CreateGlobalWeightPreset(AbandonedTZPSpawnWeight));
						});
					});
				});
			}
			if (!EnableFlare)
			{
				return;
			}
			DawnLib.DefineItem(DawnItemKeys.SignalFlare, signalFlareItem, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
			{
				builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder)
				{
					shopBuilder.OverrideCost(100);
				});
			});
		}

		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;
			GlowstickUses = ((BaseUnityPlugin)this).Config.Bind<int>("Glowsticks", "GlowstickUses", 3, "How many glowsticks are in glowstick piles?").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;
			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;
			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", "DroppedGlowstickSpawnWeight", 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 = "0.16.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 = false;

		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.LogDebug((object)("Load Data:" + saveData));
			randomtrait = saveData;
			if (randomtrait != 0)
			{
				traitGenerated = true;
			}
		}

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

		public override void Start()
		{
			((FlashlightItem)this).Start();
			if ((Object)(object)((GrabbableObject)this).itemProperties == (Object)(object)Plugin.proabaondedflashlightitem)
			{
				base.flashlightTypeID = 0;
			}
			else if ((Object)(object)((GrabbableObject)this).itemProperties == (Object)(object)Plugin.abandonedflashlightitem)
			{
				base.flashlightTypeID = 1;
			}
			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).gameObject.GetComponent<FlashlightItem>()).insertedBattery.charge = 1f * Random.Range(0.2f, 0.95f);
			}
			else
			{
				((GrabbableObject)((Component)this).gameObject.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()
		{
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			((FlashlightItem)this).Update();
			if (!((NetworkBehaviour)this).IsOwner)
			{
				return;
			}
			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;
				HandleFlickeringLight();
			}
			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)
			{
				droptimer += Time.deltaTime;
				if (((GrabbableObject)this).isHeld && droptimer > randomdroptime && randomchance > 60f)
				{
					if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
					{
						((GrabbableObject)this).playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, ((Component)((GrabbableObject)this).playerHeldBy).transform.position, true);
					}
					droptimer = 0f;
				}
			}
			if (randomtrait == 5)
			{
				if (((GrabbableObject)this).isBeingUsed)
				{
					bulbfailtimer += Time.deltaTime;
				}
				if (bulbfailtimer > randombulbfailtime && randomchance > 40f)
				{
					bulbfailures++;
					Plugin.ACALog.LogDebug((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)
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			((FlashlightItem)this).ItemActivate(used, buttonDown);
			if (!((NetworkBehaviour)this).IsOwner)
			{
				return;
			}
			Plugin.ACALog.LogDebug((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;
				if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
				{
					((GrabbableObject)this).playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, ((Component)((GrabbableObject)this).playerHeldBy).transform.position, true);
				}
				((FlashlightItem)this).SwitchFlashlight(false);
			}
			if (used)
			{
				randombulbfailtime = Random.Range(45f, 120f);
			}
			if (base.usingPlayerHelmetLight && (Object)(object)playerlightsource != (Object)null)
			{
				((Behaviour)playerlightsource).enabled = true;
			}
		}

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
			if (base.flashlightTypeID >= ((GrabbableObject)this).playerHeldBy.allHelmetLights.Length)
			{
				base.flashlightTypeID = 0;
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
				randomchance = Random.Range(0, 100);
				SetupHelmetLightFlicker();
				if (!traitGenerated || randomtrait == 0)
				{
					GenerateTrait();
				}
				if (randomtrait == 4)
				{
					randomdroptime = Random.Range(120f, 240f);
				}
			}
		}

		public override void PocketItem()
		{
			((FlashlightItem)this).PocketItem();
			if (((NetworkBehaviour)this).IsOwner && (Object)(object)playerlightsource != (Object)null)
			{
				((Behaviour)playerlightsource).enabled = true;
			}
		}

		public override void DiscardItem()
		{
			((FlashlightItem)this).DiscardItem();
			if (((NetworkBehaviour)this).IsOwner && (Object)(object)playerlightsource != (Object)null)
			{
				((Behaviour)playerlightsource).enabled = false;
				if ((Object)(object)base.previousPlayerHeldBy != (Object)null && (Object)(object)base.previousPlayerHeldBy.helmetLight != (Object)null)
				{
					base.previousPlayerHeldBy.helmetLight.intensity = 200f;
				}
			}
			flickeron = false;
		}

		private void GenerateTrait()
		{
			randomtrait = Random.Range(1, 7);
			traitGenerated = true;
			Plugin.ACALog.LogDebug((object)randomtrait);
		}

		private void SetupHelmetLightFlicker()
		{
			if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && !((Object)(object)((GrabbableObject)this).playerHeldBy.helmetLight == (Object)null))
			{
				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;
			}
		}

		private void HandleFlickeringLight()
		{
			if (!flickeron)
			{
				flickeron = true;
				flickertimebetween = Random.Range(0.5f, 2f);
				randomflickertime = Random.Range(5f, 10f);
			}
			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();
		}

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

		protected internal override string __getTypeName()
		{
			return "AbandonedFlashlightStuff";
		}
	}
	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_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
			((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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Invalid comparison between Unknown and I4
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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);
				}
			}
			else
			{
				Plugin.ACALog.LogDebug((object)"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
				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 (currentlyLit && 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(RequireOwnership = false)]
		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_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)
			//IL_00f7: 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(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))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					candleIsLitClientRpc(lit, deadCandle);
				}
			}
		}

		[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)
			//IL_00f7: 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.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 == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					currentlyLit = lit;
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2351022155u, new RpcReceiveHandler(__rpc_handler_2351022155), "candleIsLitServerRpc");
			((NetworkBehaviour)this).__registerRpc(207752887u, new RpcReceiveHandler(__rpc_handler_207752887), "candleIsLitClientRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_2351022155(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)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)1;
				((CandleStuff)(object)target).candleIsLitClientRpc(lit, deadCandle);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		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;

		private NetworkVariable<int> syncedState = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1);

		private void OnStateChanged(int oldValue, int newValue)
		{
			currentState = newValue;
			int num = Plugin.GlowstickUses - currentState;
			if (num <= 3)
			{
				int childCount = ((Component)this).transform.childCount;
				for (int i = 0; i < childCount; i++)
				{
					bool active = i >= currentState - (Plugin.GlowstickUses - 3);
					((Component)((Component)this).transform.GetChild(i)).gameObject.SetActive(active);
				}
			}
		}

		public override void Start()
		{
			if (((Object)((Component)this).gameObject).name.ToLower().Contains("droppableglowstick"))
			{
				((Behaviour)this).enabled = false;
				return;
			}
			GlowstickNetwork.EnsureWired();
			((GrabbableObject)this).Start();
			NetworkVariable<int> obj = syncedState;
			obj.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnStateChanged));
			((Component)this).GetComponentInChildren<GrabbableObject>().insertedBattery.charge = 560f;
			lighting = ((Component)this).GetComponentInChildren<Light>();
			if ((Object)(object)lighting == (Object)null)
			{
				lighting = ((Component)this).GetComponent<Light>();
			}
			((GrabbableObject)this).EnablePhysics(true);
			((GrabbableObject)this).EnableItemMeshes(true);
		}

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if (!droppedStick)
			{
				return;
			}
			Battery insertedBattery = ((Component)this).GetComponentInChildren<GrabbableObject>().insertedBattery;
			insertedBattery.charge -= Time.deltaTime % 60f;
			if (((Component)this).GetComponentInChildren<GrabbableObject>().insertedBattery.charge < 3f)
			{
				glowstickDieServerRpc();
				if (lighting.range > 0.05f)
				{
					((Collider)((Component)this).GetComponentInChildren<BoxCollider>()).enabled = false;
				}
			}
		}

		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();
			return currentState;
		}

		public override void LoadItemSaveData(int saveData)
		{
			((GrabbableObject)this).LoadItemSaveData(saveData);
			currentState = saveData;
			int childCount = ((Component)this).transform.childCount;
			for (int i = 0; i < childCount; i++)
			{
				bool active = i >= currentState;
				((Component)((Component)this).transform.GetChild(i)).gameObject.SetActive(active);
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)this).IsOwner || droppedStick || currentState >= Plugin.GlowstickUses)
			{
				return;
			}
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			currentState++;
			syncedState.Value = currentState;
			int num = Plugin.GlowstickUses - currentState;
			if (num <= 3)
			{
				int childCount = ((Component)this).transform.childCount;
				for (int i = 0; i < childCount; i++)
				{
					bool active = i >= currentState - (Plugin.GlowstickUses - 3);
					((Component)((Component)this).transform.GetChild(i)).gameObject.SetActive(active);
				}
			}
			Vector3 position = ((Component)this).transform.position;
			Quaternion rot = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
			GlowstickNetwork.SendRequest(position, rot);
			if (currentState >= Plugin.GlowstickUses && ((NetworkBehaviour)this).IsOwner && (Object)(object)base.playerHeldBy != (Object)null)
			{
				base.playerHeldBy.DestroyItemInSlotAndSync(base.playerHeldBy.currentItemSlot);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		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_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)
			//IL_00dc: 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(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))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					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)
			//IL_00dc: 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 != 1 && (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 == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if ((Object)(object)lighting == (Object)null)
				{
					lighting = ((Component)this).GetComponentInChildren<Light>();
				}
				if (!((Object)(object)lighting == (Object)null))
				{
					((Behaviour)lighting).enabled = lit;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		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_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_00c1: 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(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))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					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)
			//IL_00c1: 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.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 == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					Light obj = lighting;
					obj.intensity -= Time.deltaTime * 3f;
					Light obj2 = lighting;
					obj2.range -= Time.deltaTime * 3f;
				}
			}
		}

		protected override void __initializeVariables()
		{
			if (syncedState == null)
			{
				throw new Exception("GlowstickStuff.syncedState cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)syncedState).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedState, "syncedState");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedState);
			((GrabbableObject)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1054161706u, new RpcReceiveHandler(__rpc_handler_1054161706), "isGlowstickLitServerRpc");
			((NetworkBehaviour)this).__registerRpc(402954236u, new RpcReceiveHandler(__rpc_handler_402954236), "isGlowstickLitClientRpc");
			((NetworkBehaviour)this).__registerRpc(3923035235u, new RpcReceiveHandler(__rpc_handler_3923035235), "glowstickDieServerRpc");
			((NetworkBehaviour)this).__registerRpc(2386388057u, new RpcReceiveHandler(__rpc_handler_2386388057), "glowstickDieClientRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_1054161706(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)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)1;
				((GlowstickStuff)(object)target).isGlowstickLitClientRpc(lit);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3923035235(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;
				((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)1;
				((GlowstickStuff)(object)target).glowstickDieClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		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.LogDebug((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.LogDebug((object)("Save Data:" + (int)Mathf.Round(fuel)));
			return (int)Mathf.Round(fuel);
		}

		public void Awake()
		{
			ParticleSystem componentInChildren = ((Component)this).GetComponentInChildren<ParticleSystem>();
			Light componentInChildren2 = ((Component)this).GetComponentInChildren<Light>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.Stop(true, (ParticleSystemStopBehavior)0);
			}
			if ((Object)(object)componentInChildren2 != (Object)null)
			{
				((Behaviour)componentInChildren2).enabled = false;
			}
		}

		public override void Start()
		{
			((GrabbableObject)this).Start();
			currentstate = 0;
			lighting = ((Component)this).GetComponentInChildren<Light>();
			flame = ((Component)this).GetComponentInChildren<ParticleSystem>();
			audiosource = ((Component)this).GetComponentInChildren<AudioSource>();
			if ((Object)(object)flame == (Object)null)
			{
				flame = ((Component)this).GetComponent<ParticleSystem>();
			}
			if ((Object)(object)lighting == (Object)null)
			{
				lighting = ((Component)this).GetComponent<Light>();
			}
			if ((Object)(object)audiosource == (Object)null)
			{
				audiosource = ((Component)this).GetComponent<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);
				}
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (currentstate == 0)
			{
				currentstate = 1;
			}
			else
			{
				currentstate = 0;
			}
			timerdelay = 0f;
			if (((NetworkBehaviour)this).IsOwner)
			{
				lighterServerRpc(currentstate);
				if (currentstate == 1)
				{
					lighterOnServerRpc();
				}
				else
				{
					lighterOffServerRpc();
				}
			}
			Plugin.ACALog.LogDebug((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(currentstate);
					lighterOffServerRpc();
				}
			}
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			pocketingitem = false;
			if (((NetworkBehaviour)this).IsOwner)
			{
				lighterServerRpc(currentstate);
				if (currentstate == 1)
				{
					lighterOnServerRpc();
				}
				else
				{
					lighterOffServerRpc();
				}
			}
			Transform firstPersonLighterModel = GetFirstPersonLighterModel();
			if ((Object)(object)firstPersonLighterModel != (Object)null)
			{
				if (currentstate == 0)
				{
					((Component)firstPersonLighterModel.GetChild(1)).gameObject.SetActive(false);
					((Component)firstPersonLighterModel.GetChild(0)).gameObject.SetActive(true);
				}
				else
				{
					((Component)firstPersonLighterModel.GetChild(0)).gameObject.SetActive(false);
					((Component)firstPersonLighterModel.GetChild(1)).gameObject.SetActive(true);
				}
			}
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			if (((NetworkBehaviour)this).IsOwner)
			{
				lighterServerRpc(currentstate);
				if (lighterlit)
				{
					lighterOnServerRpc();
				}
			}
		}

		private Transform GetFirstPersonLighterModel()
		{
			if (base.isHeld && (Object)(object)base.playerHeldBy != (Object)null)
			{
				return ((Component)base.playerHeldBy.playerBodyAnimator).transform.Find("itemHolder/lighterPrefab(Clone)");
			}
			return null;
		}

		public override void Update()
		{
			//IL_0054: 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_0156: 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(currentstate);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		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_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_00c1: 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(3191699503u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3191699503u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					lighterOnClientRpc();
				}
			}
		}

		[ClientRpc]
		private void lighterOnClientRpc()
		{
			//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_00c1: 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 != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4039549238u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4039549238u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (fuel > 5f)
			{
				((Behaviour)lighting).enabled = true;
				flame.Play();
				timerdelay = 0f;
				if (((NetworkBehaviour)this).IsOwner)
				{
					audiosource.clip = burningflame;
					audiosource.pitch = Random.Range(0.9f, 1.1f);
					audiosource.loop = true;
					audiosource.Play();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void lighterOffServerRpc()
		{
			//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_00c1: 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(2507464244u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2507464244u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					lighterOffClientRpc();
				}
			}
		}

		[ClientRpc]
		private void lighterOffClientRpc()
		{
			//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_00c1: 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 != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3919049416u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3919049416u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if ((Object)(object)flame != (Object)null)
				{
					flame.Stop(true, (ParticleSystemStopBehavior)0);
					flame.Clear();
				}
				if ((Object)(object)lighting != (Object)null)
				{
					((Behaviour)lighting).enabled = false;
				}
				if ((Object)(object)audiosource != (Object)null)
				{
					audiosource.Stop();
				}
				lighterlit = false;
				currentstate = 0;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void lighterServerRpc(int newState)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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)
			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(1658303523u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, newState);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1658303523u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					lighterClientRpc(newState);
				}
			}
		}

		[ClientRpc]
		private void lighterClientRpc(int newState)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1814021087u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, newState);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1814021087u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			currentstate = newState;
			Transform firstPersonLighterModel = GetFirstPersonLighterModel();
			if ((Object)(object)firstPersonLighterModel != (Object)null)
			{
				if (newState == 0)
				{
					((Component)firstPersonLighterModel.GetChild(1)).gameObject.SetActive(false);
					((Component)firstPersonLighterModel.GetChild(0)).gameObject.SetActive(true);
				}
				else
				{
					((Component)firstPersonLighterModel.GetChild(0)).gameObject.SetActive(false);
					((Component)firstPersonLighterModel.GetChild(1)).gameObject.SetActive(true);
				}
			}
			if (newState == 0)
			{
				if (!pocketingitem)
				{
					((Component)((Component)this).gameObject.transform.GetChild(1)).gameObject.SetActive(false);
					((Component)((Component)this).gameObject.transform.GetChild(0)).gameObject.SetActive(true);
				}
				if ((Object)(object)flame != (Object)null)
				{
					flame.Clear();
					flame.Stop();
				}
				if (((NetworkBehaviour)this).IsOwner && (Object)(object)audiosource != (Object)null)
				{
					audiosource.Stop();
					audiosource.PlayOneShot(lighterclose);
				}
				if ((Object)(object)lighting != (Object)null)
				{
					((Behaviour)lighting).enabled = false;
				}
				lighterlit = false;
			}
			else
			{
				if (!pocketingitem)
				{
					((Component)((Component)this).gameObject.transform.GetChild(0)).gameObject.SetActive(false);
					((Component)((Component)this).gameObject.transform.GetChild(1)).gameObject.SetActive(true);
				}
				if (((NetworkBehaviour)this).IsOwner && (Object)(object)audiosource != (Object)null)
				{
					audiosource.PlayOneShot(lighterflick);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void lighterDeadServerRpc()
		{
			//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_00c1: 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(153992748u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 153992748u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					lighterDeadClientRpc();
				}
			}
		}

		[ClientRpc]
		private void lighterDeadClientRpc()
		{
			//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_00c1: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1118566489u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1118566489u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					fuel = 0f;
					lighterdead = true;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void fireSpawnServerRpc(Vector3 position)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_0089: 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_00d5: 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(1276072043u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1276072043u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					fireSpawnClientRpc(position);
				}
			}
		}

		[ClientRpc]
		private void fireSpawnClientRpc(Vector3 position)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_0089: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(606520659u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 606520659u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					GameObject val3 = Object.Instantiate<GameObject>(Plugin.webBurnParticles.gameObject, position, default(Quaternion), StartOfRound.Instance.propsContainer);
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(3191699503u, new RpcReceiveHandler(__rpc_handler_3191699503), "lighterOnServerRpc");
			((NetworkBehaviour)this).__registerRpc(4039549238u, new RpcReceiveHandler(__rpc_handler_4039549238), "lighterOnClientRpc");
			((NetworkBehaviour)this).__registerRpc(2507464244u, new RpcReceiveHandler(__rpc_handler_2507464244), "lighterOffServerRpc");
			((NetworkBehaviour)this).__registerRpc(3919049416u, new RpcReceiveHandler(__rpc_handler_3919049416), "lighterOffClientRpc");
			((NetworkBehaviour)this).__registerRpc(1658303523u, new RpcReceiveHandler(__rpc_handler_1658303523), "lighterServerRpc");
			((NetworkBehaviour)this).__registerRpc(1814021087u, new RpcReceiveHandler(__rpc_handler_1814021087), "lighterClientRpc");
			((NetworkBehaviour)this).__registerRpc(153992748u, new RpcReceiveHandler(__rpc_handler_153992748), "lighterDeadServerRpc");
			((NetworkBehaviour)this).__registerRpc(1118566489u, new RpcReceiveHandler(__rpc_handler_1118566489), "lighterDeadClientRpc");
			((NetworkBehaviour)this).__registerRpc(1276072043u, new RpcReceiveHandler(__rpc_handler_1276072043), "fireSpawnServerRpc");
			((NetworkBehaviour)this).__registerRpc(606520659u, new RpcReceiveHandler(__rpc_handler_606520659), "fireSpawnClientRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_3191699503(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;
				((lighterStuff)(object)target).lighterOnServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4039549238(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;
				((lighterStuff)(object)target).lighterOnClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2507464244(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;
				((lighterStuff)(object)target).lighterOffServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3919049416(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;
				((lighterStuff)(object)target).lighterOffClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1658303523(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int newState = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref newState);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((lighterStuff)(object)target).lighterServerRpc(newState);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1814021087(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int newState = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref newState);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((lighterStuff)(object)target).lighterClientRpc(newState);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_153992748(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;
				((lighterStuff)(object)target).lighterDeadServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1118566489(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;
				((lighterStuff)(object)target).lighterDeadClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1276072043(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((lighterStuff)(object)target).fireSpawnServerRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_606520659(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((lighterStuff)(object)target).fireSpawnClientRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "lighterStuff";
		}
	}
	internal class SignalFlare : GrabbableObject
	{
		private ParticleSystem particles;

		private AudioSource audiosource;

		public AudioClip thumpSound;

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
		}

		public override void Start()
		{
			((GrabbableObject)this).Start();
			particles = ((Component)this).GetComponentInChildren<ParticleSystem>();
			audiosource = ((Component)this).GetComponent<AudioSource>();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!((NetworkBehaviour)this).IsOwner)
			{
				return;
			}
			audiosource.PlayOneShot(thumpSound);
			if (!GameNetworkManager.