Decompiled source of Lategame Upgrades v3.2.4

BepInEx/plugins/MoreShipUpgrades/MoreShipUpgrades.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using MoreShipUpgrades.Compat;
using MoreShipUpgrades.Input;
using MoreShipUpgrades.Managers;
using MoreShipUpgrades.Misc;
using MoreShipUpgrades.Misc.TerminalNodes;
using MoreShipUpgrades.Misc.Upgrades;
using MoreShipUpgrades.UpgradeComponents.Commands;
using MoreShipUpgrades.UpgradeComponents.Contracts;
using MoreShipUpgrades.UpgradeComponents.Interfaces;
using MoreShipUpgrades.UpgradeComponents.Items;
using MoreShipUpgrades.UpgradeComponents.Items.Contracts.BombDefusal;
using MoreShipUpgrades.UpgradeComponents.Items.Contracts.DataRetrieval;
using MoreShipUpgrades.UpgradeComponents.Items.Contracts.Exorcism;
using MoreShipUpgrades.UpgradeComponents.Items.Contracts.Exterminator;
using MoreShipUpgrades.UpgradeComponents.Items.Contracts.Extraction;
using MoreShipUpgrades.UpgradeComponents.Items.PortableTeleporter;
using MoreShipUpgrades.UpgradeComponents.Items.Wheelbarrow;
using MoreShipUpgrades.UpgradeComponents.OneTimeUpgrades;
using MoreShipUpgrades.UpgradeComponents.TierUpgrades;
using MoreShipUpgrades.UpgradeComponents.TierUpgrades.AttributeUpgrades;
using Newtonsoft.Json;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.LowLevel;
using UnityEngine.UI;

[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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.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;
		}
	}
}
namespace MoreShipUpgrades
{
	[BepInPlugin("com.malco.lethalcompany.moreshipupgrades", "More Ship Upgrades", "3.2.2")]
	[BepInDependency("evaisa.lethallib", "0.13.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("com.malco.lethalcompany.moreshipupgrades");

		internal static readonly ManualLogSource mls = Logger.CreateLogSource("More Ship Upgrades");

		private AudioClip itemBreak;

		private AudioClip buttonPressed;

		private AudioClip error;

		private const string root = "Assets/ShipUpgrades/";

		private AudioClip[] wheelbarrowSound;

		private AudioClip[] shoppingCartSound;

		public static PluginConfig PluginConfiguration { get; private set; }

		private void Awake()
		{
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			PluginConfiguration = new PluginConfig(((BaseUnityPlugin)this).Config);
			PluginConfiguration.InitBindings();
			IEnumerable<Type> enumerable;
			try
			{
				enumerable = Assembly.GetExecutingAssembly().GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				enumerable = ex.Types.Where((Type t) => t != null);
			}
			foreach (Type item in enumerable)
			{
				MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array = methods;
				foreach (MethodInfo methodInfo in array)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "shipupgrades");
			AssetBundle bundle = AssetBundle.LoadFromFile(text);
			GameObject val = new GameObject("UpgradeBus");
			val.AddComponent<UpgradeBus>();
			val = new GameObject("SpawnItemManager");
			val.AddComponent<SpawnItemManager>();
			UpgradeBus.Instance.version = "3.2.2";
			UpgradeBus.Instance.UpgradeAssets = bundle;
			SetupModStore(ref bundle);
			SetupIntroScreen(ref bundle);
			SetupItems();
			SetupPerks();
			SetupContractMapObjects(ref bundle);
			if (InputUtils_Compat.Enabled)
			{
				InputUtils_Compat.Init();
			}
			harmony.PatchAll();
			mls.LogDebug((object)"LGU has been patched");
		}

		public void sendModInfo()
		{
			foreach (KeyValuePair<string, PluginInfo> item in Chainloader.PluginInfos.Where((KeyValuePair<string, PluginInfo> plugin) => plugin.Value.Metadata.GUID.Contains("ModSync")))
			{
				try
				{
					List<string> list = new List<string> { "malco", "LateGameUpgrades" };
					((Component)item.Value.Instance).BroadcastMessage("getModInfo", (object)list, (SendMessageOptions)1);
				}
				catch (Exception ex)
				{
					mls.LogDebug((object)("Failed to send info to ModSync, go yell at Minx for " + ex.StackTrace));
				}
			}
		}

		private void SetupContractMapObjects(ref AssetBundle bundle)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			AnimationCurve curve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
			{
				new Keyframe(0f, 1f),
				new Keyframe(1f, 1f)
			});
			SetupScavContract(ref bundle, curve);
			SetupExterminatorContract(ref bundle, curve);
			SetupDataContract(ref bundle, curve);
			SetupExorcismContract(ref bundle, curve);
			SetupBombContract(ref bundle, curve);
		}

		private void SetupBombContract(ref AssetBundle bundle, AnimationCurve curve)
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			Item val = AssetBundleHandler.TryLoadItemAsset(ref bundle, "Assets/ShipUpgrades/BombItem.asset");
			val.spawnPrefab.AddComponent<ScrapValueSyncer>();
			val.isConductiveMetal = false;
			DefusalContract defusalContract = val.spawnPrefab.AddComponent<DefusalContract>();
			defusalContract.SetPosition = true;
			BombDefusalScript bombDefusalScript = val.spawnPrefab.AddComponent<BombDefusalScript>();
			bombDefusalScript.snip = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, "Assets/ShipUpgrades/scissors.mp3");
			bombDefusalScript.tick = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, "Assets/ShipUpgrades/tick.mp3");
			Utilities.FixMixerGroups(val.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Items.RegisterItem(val);
			SpawnableMapObjectDef val2 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
			val2.spawnableMapObject = new SpawnableMapObject();
			val2.spawnableMapObject.prefabToSpawn = val.spawnPrefab;
			MapObjects.RegisterMapObject(val2, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve));
		}

		private void SetupExorcismContract(ref AssetBundle bundle, AnimationCurve curve)
		{
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Expected O, but got Unknown
			Item val = AssetBundleHandler.TryLoadItemAsset(ref bundle, "Assets/ShipUpgrades/ExorcLootItem.asset");
			val.spawnPrefab.AddComponent<ScrapValueSyncer>();
			Items.RegisterItem(val);
			Utilities.FixMixerGroups(val.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Item val2 = AssetBundleHandler.TryLoadItemAsset(ref bundle, "Assets/ShipUpgrades/PentagramItem.asset");
			string[] array = new string[5] { "Heart.asset", "Crucifix.asset", "candelabraItem.asset", "Teddy Bear.asset", "Bones.asset" };
			string[] array2 = array;
			foreach (string text in array2)
			{
				Item val3 = AssetBundleHandler.TryLoadItemAsset(ref bundle, "Assets/ShipUpgrades/RitualItems/" + text);
				val3.spawnPrefab.AddComponent<ExorcismContract>();
				Items.RegisterItem(val3);
				Utilities.FixMixerGroups(val3.spawnPrefab);
				NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
				SpawnableMapObjectDef val4 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
				val4.spawnableMapObject = new SpawnableMapObject();
				val4.spawnableMapObject.prefabToSpawn = val3.spawnPrefab;
				MapObjects.RegisterMapObject(val4, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => new AnimationCurve((Keyframe[])(object)new Keyframe[2]
				{
					new Keyframe(0f, 3f),
					new Keyframe(1f, 3f)
				})));
			}
			ExorcismContract exorcismContract = val2.spawnPrefab.AddComponent<ExorcismContract>();
			exorcismContract.SetPosition = true;
			PentagramScript pentagramScript = val2.spawnPrefab.AddComponent<PentagramScript>();
			pentagramScript.loot = val.spawnPrefab;
			pentagramScript.chant = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, "Assets/ShipUpgrades/ritualSFX.mp3");
			pentagramScript.portal = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, "Assets/ShipUpgrades/portal.mp3");
			Utilities.FixMixerGroups(val2.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterItem(val2);
			SpawnableMapObjectDef val5 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
			val5.spawnableMapObject = new SpawnableMapObject();
			val5.spawnableMapObject.prefabToSpawn = val2.spawnPrefab;
			MapObjects.RegisterMapObject(val5, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve));
		}

		private void SetupExterminatorContract(ref AssetBundle bundle, AnimationCurve curve)
		{
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			Item val = AssetBundleHandler.TryLoadItemAsset(ref bundle, "Assets/ShipUpgrades/EggLootItem.asset");
			val.spawnPrefab.AddComponent<ScrapValueSyncer>();
			Items.RegisterItem(val);
			Utilities.FixMixerGroups(val.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Item val2 = AssetBundleHandler.TryLoadItemAsset(ref bundle, "Assets/ShipUpgrades/HoardingEggItem.asset");
			ExterminatorContract exterminatorContract = val2.spawnPrefab.AddComponent<ExterminatorContract>();
			exterminatorContract.SetPosition = true;
			BugNestScript bugNestScript = val2.spawnPrefab.AddComponent<BugNestScript>();
			bugNestScript.loot = val.spawnPrefab;
			Utilities.FixMixerGroups(val2.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterItem(val2);
			SpawnableMapObjectDef val3 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
			val3.spawnableMapObject = new SpawnableMapObject();
			val3.spawnableMapObject.prefabToSpawn = val2.spawnPrefab;
			MapObjects.RegisterMapObject(val3, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve));
		}

		private void SetupScavContract(ref AssetBundle bundle, AnimationCurve curve)
		{
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Expected O, but got Unknown
			Item val = AssetBundleHandler.TryLoadItemAsset(ref bundle, "Assets/ShipUpgrades/ScavItem.asset");
			if (!((Object)(object)val == (Object)null))
			{
				val.weight = UpgradeBus.Instance.PluginConfiguration.CONTRACT_EXTRACT_WEIGHT.Value;
				ExtractionContract extractionContract = val.spawnPrefab.AddComponent<ExtractionContract>();
				extractionContract.SetPosition = true;
				ExtractPlayerScript extractPlayerScript = val.spawnPrefab.AddComponent<ExtractPlayerScript>();
				val.spawnPrefab.AddComponent<ScrapValueSyncer>();
				TextAsset val2 = AssetBundleHandler.TryLoadOtherAsset<TextAsset>(ref bundle, "Assets/ShipUpgrades/scavSounds/scavAudio.json");
				Dictionary<string, string[]> dictionary = JsonConvert.DeserializeObject<Dictionary<string, string[]>>(val2.text);
				ExtractPlayerScript.clipDict.Add("lost", CreateAudioClipArray(dictionary["lost"], ref bundle));
				ExtractPlayerScript.clipDict.Add("heal", CreateAudioClipArray(dictionary["heal"], ref bundle));
				ExtractPlayerScript.clipDict.Add("safe", CreateAudioClipArray(dictionary["safe"], ref bundle));
				ExtractPlayerScript.clipDict.Add("held", CreateAudioClipArray(dictionary["held"], ref bundle));
				Utilities.FixMixerGroups(val.spawnPrefab);
				NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
				Items.RegisterItem(val);
				SpawnableMapObjectDef val3 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
				val3.spawnableMapObject = new SpawnableMapObject();
				val3.spawnableMapObject.prefabToSpawn = val.spawnPrefab;
				MapObjects.RegisterMapObject(val3, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve));
			}
		}

		private void SetupDataContract(ref AssetBundle bundle, AnimationCurve curve)
		{
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Expected O, but got Unknown
			Item val = AssetBundleHandler.TryLoadItemAsset(ref bundle, "Assets/ShipUpgrades/DiscItem.asset");
			val.spawnPrefab.AddComponent<ScrapValueSyncer>();
			Items.RegisterItem(val);
			Utilities.FixMixerGroups(val.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Item val2 = AssetBundleHandler.TryLoadItemAsset(ref bundle, "Assets/ShipUpgrades/DataPCItem.asset");
			DataRetrievalContract dataRetrievalContract = val2.spawnPrefab.AddComponent<DataRetrievalContract>();
			dataRetrievalContract.SetPosition = true;
			DataPCScript dataPCScript = val2.spawnPrefab.AddComponent<DataPCScript>();
			dataPCScript.error = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, "Assets/ShipUpgrades/winError.mp3");
			dataPCScript.startup = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, "Assets/ShipUpgrades/startup.mp3");
			dataPCScript.loot = val.spawnPrefab;
			Utilities.FixMixerGroups(val2.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterItem(val2);
			SpawnableMapObjectDef val3 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
			val3.spawnableMapObject = new SpawnableMapObject();
			val3.spawnableMapObject.prefabToSpawn = val2.spawnPrefab;
			MapObjects.RegisterMapObject(val3, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve));
		}

		private AudioClip[] CreateAudioClipArray(string[] paths, ref AssetBundle bundle)
		{
			AudioClip[] array = (AudioClip[])(object)new AudioClip[paths.Length];
			for (int i = 0; i < paths.Length; i++)
			{
				array[i] = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, paths[i]);
			}
			return array;
		}

		private void SetupModStore(ref AssetBundle bundle)
		{
			GameObject val = AssetBundleHandler.TryLoadGameObjectAsset(ref bundle, "Assets/ShipUpgrades/LguStore.prefab");
			if (!((Object)(object)val == (Object)null))
			{
				val.AddComponent<ConfigSynchronizationManager>();
				val.AddComponent<ContractManager>();
				val.AddComponent<LguStore>();
				NetworkPrefabs.RegisterNetworkPrefab(val);
				UpgradeBus.Instance.modStorePrefab = val;
			}
		}

		private void SetupIntroScreen(ref AssetBundle bundle)
		{
			UpgradeBus.Instance.IntroScreen = AssetBundleHandler.TryLoadGameObjectAsset(ref bundle, "Assets/ShipUpgrades/IntroScreen.prefab");
			if ((Object)(object)UpgradeBus.Instance.IntroScreen != (Object)null)
			{
				UpgradeBus.Instance.IntroScreen.AddComponent<IntroScreenScript>();
			}
		}

		private void SetupItems()
		{
			SetupTeleporterButtons();
			SetupNightVision();
			SetupMedkit();
			SetupPeeper();
			SetupSamples();
			SetupHelmet();
			SetupDivingKit();
			SetupWheelbarrows();
		}

		private void SetupSamples()
		{
			Dictionary<string, int> dictionary = new Dictionary<string, int>
			{
				{
					"centipede",
					PluginConfiguration.SNARE_FLEA_SAMPLE_MINIMUM_VALUE.Value
				},
				{
					"bunker spider",
					PluginConfiguration.BUNKER_SPIDER_SAMPLE_MINIMUM_VALUE.Value
				},
				{
					"hoarding bug",
					PluginConfiguration.HOARDING_BUG_SAMPLE_MINIMUM_VALUE.Value
				},
				{
					"flowerman",
					PluginConfiguration.BRACKEN_SAMPLE_MINIMUM_VALUE.Value
				},
				{
					"mouthdog",
					PluginConfiguration.EYELESS_DOG_SAMPLE_MINIMUM_VALUE.Value
				},
				{
					"baboon hawk",
					PluginConfiguration.BABOON_HAWK_SAMPLE_MINIMUM_VALUE.Value
				},
				{
					"crawler",
					PluginConfiguration.THUMPER_SAMPLE_MINIMUM_VALUE.Value
				}
			};
			Dictionary<string, int> dictionary2 = new Dictionary<string, int>
			{
				{
					"centipede",
					PluginConfiguration.SNARE_FLEA_SAMPLE_MAXIMUM_VALUE.Value
				},
				{
					"bunker spider",
					PluginConfiguration.BUNKER_SPIDER_SAMPLE_MAXIMUM_VALUE.Value
				},
				{
					"hoarding bug",
					PluginConfiguration.HOARDING_BUG_SAMPLE_MAXIMUM_VALUE.Value
				},
				{
					"flowerman",
					PluginConfiguration.BRACKEN_SAMPLE_MAXIMUM_VALUE.Value
				},
				{
					"mouthdog",
					PluginConfiguration.EYELESS_DOG_SAMPLE_MAXIMUM_VALUE.Value
				},
				{
					"baboon hawk",
					PluginConfiguration.BABOON_HAWK_SAMPLE_MAXIMUM_VALUE.Value
				},
				{
					"crawler",
					PluginConfiguration.THUMPER_SAMPLE_MAXIMUM_VALUE.Value
				}
			};
			foreach (string key in AssetBundleHandler.samplePaths.Keys)
			{
				Item itemObject = AssetBundleHandler.GetItemObject(key);
				MonsterSample monsterSample = itemObject.spawnPrefab.AddComponent<MonsterSample>();
				((GrabbableObject)monsterSample).grabbable = true;
				((GrabbableObject)monsterSample).grabbableToEnemies = true;
				((GrabbableObject)monsterSample).itemProperties = itemObject;
				((GrabbableObject)monsterSample).itemProperties.minValue = dictionary[key];
				((GrabbableObject)monsterSample).itemProperties.maxValue = dictionary2[key];
				itemObject.spawnPrefab.AddComponent<ScrapValueSyncer>();
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				SpawnItemManager.Instance.samplePrefabs.Add(key, itemObject.spawnPrefab);
			}
		}

		private void SetupTeleporterButtons()
		{
			itemBreak = AssetBundleHandler.GetAudioClip("Break");
			error = AssetBundleHandler.GetAudioClip("Error");
			buttonPressed = AssetBundleHandler.GetAudioClip("Button Press");
			if (!((Object)(object)itemBreak == (Object)null) && !((Object)(object)error == (Object)null) && !((Object)(object)buttonPressed == (Object)null))
			{
				SetupRegularTeleporterButton();
				SetupAdvancedTeleporterButton();
			}
		}

		private void SetupHelmet()
		{
			Item itemObject = AssetBundleHandler.GetItemObject("HelmetItem");
			UpgradeBus.Instance.helmetModel = AssetBundleHandler.GetPerkGameObject("HelmetModel");
			if (!((Object)(object)itemObject == (Object)null))
			{
				UpgradeBus.Instance.SFX.Add("helmet", AssetBundleHandler.GetAudioClip("HelmetHit"));
				UpgradeBus.Instance.SFX.Add("breakWood", AssetBundleHandler.GetAudioClip("breakWood"));
				Helmet helmet = itemObject.spawnPrefab.AddComponent<Helmet>();
				((GrabbableObject)helmet).itemProperties = itemObject;
				((GrabbableObject)helmet).grabbable = true;
				((GrabbableObject)helmet).grabbableToEnemies = true;
				itemObject.creditsWorth = PluginConfiguration.HELMET_PRICE.Value;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				UpgradeBus.Instance.ItemsToSync.Add("Helmet", itemObject);
				SetupStoreItem(itemObject);
			}
		}

		private TerminalNode SetupInfoNode(Item storeItem)
		{
			TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
			GrabbableObject component = storeItem.spawnPrefab.GetComponent<GrabbableObject>();
			if (component is IDisplayInfo displayInfo)
			{
				val.displayText = val.displayText + displayInfo.GetDisplayInfo() + "\n";
			}
			if (component is IItemWorldBuilding itemWorldBuilding)
			{
				val.displayText = val.displayText + itemWorldBuilding.GetWorldBuildingText() + "\n";
			}
			val.clearPreviousText = true;
			return val;
		}

		private void SetupStoreItem(Item storeItem)
		{
			TerminalNode val = SetupInfoNode(storeItem);
			Items.RegisterShopItem(storeItem, (TerminalNode)null, (TerminalNode)null, val, storeItem.creditsWorth);
		}

		private void SetupRegularTeleporterButton()
		{
			Item itemObject = AssetBundleHandler.GetItemObject("Portable Tele");
			if (!((Object)(object)itemObject == (Object)null))
			{
				itemObject.itemName = "Portable Tele";
				itemObject.itemId = 492012;
				RegularPortableTeleporter regularPortableTeleporter = itemObject.spawnPrefab.AddComponent<RegularPortableTeleporter>();
				((GrabbableObject)regularPortableTeleporter).itemProperties = itemObject;
				((GrabbableObject)regularPortableTeleporter).grabbable = true;
				((GrabbableObject)regularPortableTeleporter).grabbableToEnemies = true;
				regularPortableTeleporter.ItemBreak = itemBreak;
				((GrabbableObject)regularPortableTeleporter).useCooldown = 2f;
				regularPortableTeleporter.error = error;
				regularPortableTeleporter.buttonPress = buttonPressed;
				itemObject.creditsWorth = PluginConfiguration.WEAK_TELE_PRICE.Value;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				UpgradeBus.Instance.ItemsToSync.Add("Tele", itemObject);
				SetupStoreItem(itemObject);
			}
		}

		private void SetupAdvancedTeleporterButton()
		{
			Item itemObject = AssetBundleHandler.GetItemObject("Advanced Portable Tele");
			if (!((Object)(object)itemObject == (Object)null))
			{
				itemObject.creditsWorth = PluginConfiguration.ADVANCED_TELE_PRICE.Value;
				itemObject.itemName = "Advanced Portable Tele";
				itemObject.itemId = 492013;
				AdvancedPortableTeleporter advancedPortableTeleporter = itemObject.spawnPrefab.AddComponent<AdvancedPortableTeleporter>();
				((GrabbableObject)advancedPortableTeleporter).itemProperties = itemObject;
				((GrabbableObject)advancedPortableTeleporter).grabbable = true;
				((GrabbableObject)advancedPortableTeleporter).useCooldown = 2f;
				((GrabbableObject)advancedPortableTeleporter).grabbableToEnemies = true;
				advancedPortableTeleporter.ItemBreak = itemBreak;
				advancedPortableTeleporter.error = error;
				advancedPortableTeleporter.buttonPress = buttonPressed;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				UpgradeBus.Instance.ItemsToSync.Add("AdvTele", itemObject);
				SetupStoreItem(itemObject);
			}
		}

		private void SetupNightVision()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			Item itemObject = AssetBundleHandler.GetItemObject("Night Vision");
			if (!((Object)(object)itemObject == (Object)null))
			{
				itemObject.creditsWorth = PluginConfiguration.NIGHT_VISION_PRICE.Value;
				itemObject.spawnPrefab.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
				itemObject.itemId = 492014;
				NightVisionGoggles nightVisionGoggles = itemObject.spawnPrefab.AddComponent<NightVisionGoggles>();
				((GrabbableObject)nightVisionGoggles).itemProperties = itemObject;
				((GrabbableObject)nightVisionGoggles).grabbable = true;
				((GrabbableObject)nightVisionGoggles).useCooldown = 2f;
				((GrabbableObject)nightVisionGoggles).grabbableToEnemies = true;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				UpgradeBus.Instance.ItemsToSync.Add("Night", itemObject);
				SetupStoreItem(itemObject);
			}
		}

		private void SetupDivingKit()
		{
			Item itemObject = AssetBundleHandler.GetItemObject("Diving Kit");
			if (!((Object)(object)itemObject == (Object)null))
			{
				itemObject.creditsWorth = PluginConfiguration.DIVEKIT_PRICE.Value;
				itemObject.itemId = 492015;
				itemObject.twoHanded = PluginConfiguration.DIVEKIT_TWO_HANDED.Value;
				itemObject.weight = PluginConfiguration.DIVEKIT_WEIGHT.Value;
				itemObject.itemSpawnsOnGround = true;
				DivingKit divingKit = itemObject.spawnPrefab.AddComponent<DivingKit>();
				((GrabbableObject)divingKit).itemProperties = itemObject;
				((GrabbableObject)divingKit).grabbable = true;
				((GrabbableObject)divingKit).grabbableToEnemies = true;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				UpgradeBus.Instance.ItemsToSync.Add("Dive", itemObject);
				SetupStoreItem(itemObject);
			}
		}

		private void SetupMedkit()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			Item itemObject = AssetBundleHandler.GetItemObject("Medkit");
			if ((Object)(object)itemObject == (Object)null)
			{
				return;
			}
			AnimationCurve curve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
			{
				new Keyframe(0f, 3f),
				new Keyframe(1f, 3f)
			});
			itemObject.creditsWorth = PluginConfiguration.MEDKIT_PRICE.Value;
			itemObject.itemId = 492016;
			Medkit medkit = itemObject.spawnPrefab.AddComponent<Medkit>();
			((GrabbableObject)medkit).itemProperties = itemObject;
			((GrabbableObject)medkit).grabbable = true;
			((GrabbableObject)medkit).useCooldown = 2f;
			((GrabbableObject)medkit).grabbableToEnemies = true;
			medkit.error = error;
			medkit.use = buttonPressed;
			NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
			SetupStoreItem(itemObject);
			Item itemObject2 = AssetBundleHandler.GetItemObject("MedkitMapItem");
			if (!((Object)(object)itemObject2 == (Object)null))
			{
				Medkit medkit2 = itemObject2.spawnPrefab.AddComponent<Medkit>();
				itemObject2.spawnPrefab.AddComponent<ExtractionContract>();
				((GrabbableObject)medkit2).itemProperties = itemObject2;
				((GrabbableObject)medkit2).grabbable = true;
				((GrabbableObject)medkit2).useCooldown = 2f;
				((GrabbableObject)medkit2).grabbableToEnemies = true;
				medkit2.error = error;
				medkit2.use = buttonPressed;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject2.spawnPrefab);
				SpawnableMapObjectDef val = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
				val.spawnableMapObject = new SpawnableMapObject();
				val.spawnableMapObject.prefabToSpawn = itemObject2.spawnPrefab;
				MapObjects.RegisterMapObject(val, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve));
				UpgradeBus.Instance.ItemsToSync.Add("Medkit", itemObject);
			}
		}

		private void SetupPeeper()
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			Item itemObject = AssetBundleHandler.GetItemObject("Peeper");
			if (!((Object)(object)itemObject == (Object)null))
			{
				itemObject.creditsWorth = PluginConfiguration.PEEPER_PRICE.Value;
				itemObject.twoHanded = false;
				itemObject.itemId = 492017;
				itemObject.twoHandedAnimation = false;
				itemObject.spawnPrefab.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
				Peeper peeper = itemObject.spawnPrefab.AddComponent<Peeper>();
				((GrabbableObject)peeper).itemProperties = itemObject;
				((GrabbableObject)peeper).grabbable = true;
				((GrabbableObject)peeper).grabbableToEnemies = true;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				UpgradeBus.Instance.ItemsToSync.Add("Peeper", itemObject);
				SetupStoreItem(itemObject);
			}
		}

		private void SetupWheelbarrows()
		{
			wheelbarrowSound = GetAudioClipList("Wheelbarrow Sound", 4);
			shoppingCartSound = GetAudioClipList("Scrap Wheelbarrow Sound", 4);
			SetupStoreWheelbarrow();
			SetupScrapWheelbarrow();
		}

		private AudioClip[] GetAudioClipList(string name, int length)
		{
			AudioClip[] array = (AudioClip[])(object)new AudioClip[length];
			for (int i = 0; i < length; i++)
			{
				array[i] = AssetBundleHandler.GetAudioClip($"{name} {i}");
			}
			return array;
		}

		private void SetupScrapWheelbarrow()
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Expected O, but got Unknown
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Expected O, but got Unknown
			Item itemObject = AssetBundleHandler.GetItemObject("Scrap Wheelbarrow");
			if (!((Object)(object)itemObject == (Object)null))
			{
				itemObject.itemId = 492018;
				itemObject.minValue = PluginConfiguration.SCRAP_WHEELBARROW_MINIMUM_VALUE.Value;
				itemObject.maxValue = PluginConfiguration.SCRAP_WHEELBARROW_MAXIMUM_VALUE.Value;
				itemObject.twoHanded = true;
				itemObject.twoHandedAnimation = true;
				itemObject.grabAnim = "HoldJetpack";
				itemObject.floorYOffset = -90;
				itemObject.positionOffset = new Vector3(0f, -1.7f, 0.35f);
				itemObject.allowDroppingAheadOfPlayer = true;
				itemObject.isConductiveMetal = true;
				itemObject.isScrap = true;
				itemObject.weight = 0.99f + PluginConfiguration.SCRAP_WHEELBARROW_WEIGHT.Value / 100f;
				itemObject.canBeGrabbedBeforeGameStart = true;
				ScrapWheelbarrow scrapWheelbarrow = itemObject.spawnPrefab.AddComponent<ScrapWheelbarrow>();
				itemObject.toolTips = SetupWheelbarrowTooltips();
				((GrabbableObject)scrapWheelbarrow).itemProperties = itemObject;
				scrapWheelbarrow.wheelsClip = shoppingCartSound;
				itemObject.spawnPrefab.AddComponent<ScrapValueSyncer>();
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				Items.RegisterItem(itemObject);
				Utilities.FixMixerGroups(itemObject.spawnPrefab);
				int num = (PluginConfiguration.SCRAP_WHEELBARROW_ENABLED.Value ? 1 : 0);
				AnimationCurve curve = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
				{
					new Keyframe(0f, 0f),
					new Keyframe(1f - PluginConfiguration.SCRAP_WHEELBARROW_RARITY.Value, (float)num),
					new Keyframe(1f, (float)num)
				});
				SpawnableMapObjectDef val = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
				val.spawnableMapObject = new SpawnableMapObject();
				val.spawnableMapObject.prefabToSpawn = itemObject.spawnPrefab;
				MapObjects.RegisterMapObject(val, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve));
			}
		}

		private void SetupStoreWheelbarrow()
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			Item itemObject = AssetBundleHandler.GetItemObject("Store Wheelbarrow");
			if (!((Object)(object)itemObject == (Object)null))
			{
				itemObject.itemId = 492019;
				itemObject.creditsWorth = PluginConfiguration.WHEELBARROW_PRICE.Value;
				itemObject.twoHanded = true;
				itemObject.twoHandedAnimation = true;
				itemObject.grabAnim = "HoldJetpack";
				itemObject.floorYOffset = -90;
				itemObject.verticalOffset = 0.3f;
				itemObject.positionOffset = new Vector3(0f, -0.7f, 1.4f);
				itemObject.allowDroppingAheadOfPlayer = true;
				itemObject.isConductiveMetal = true;
				itemObject.weight = 0.99f + PluginConfiguration.WHEELBARROW_WEIGHT.Value / 100f;
				itemObject.canBeGrabbedBeforeGameStart = true;
				StoreWheelbarrow storeWheelbarrow = itemObject.spawnPrefab.AddComponent<StoreWheelbarrow>();
				itemObject.toolTips = SetupWheelbarrowTooltips();
				((GrabbableObject)storeWheelbarrow).itemProperties = itemObject;
				storeWheelbarrow.wheelsClip = wheelbarrowSound;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				Utilities.FixMixerGroups(itemObject.spawnPrefab);
				UpgradeBus.Instance.ItemsToSync.Add("Wheel", itemObject);
				SetupStoreItem(itemObject);
			}
		}

		private string[] SetupWheelbarrowTooltips()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			Key val = (Key)0;
			MouseButton val2 = (MouseButton)2;
			string value = UpgradeBus.Instance.PluginConfiguration.WHEELBARROW_DROP_ALL_CONTROL_BIND.Value;
			bool flag;
			if (Enum.TryParse<Key>(value, out Key result))
			{
				val = result;
				flag = true;
			}
			else
			{
				flag = false;
			}
			bool flag2;
			if (Enum.TryParse<MouseButton>(value, out MouseButton result2))
			{
				val2 = result2;
				flag2 = true;
			}
			else
			{
				flag2 = false;
			}
			string text = (flag2 ? ((object)(MouseButton)(ref val2)).ToString() : "MMB");
			string text2 = (flag ? ((object)(Key)(ref val)).ToString() : text);
			return new string[1] { "Drop all items: [" + text2 + "]" };
		}

		private void SetupPerks()
		{
			SetupBeekeeper();
			SetupProteinPowder();
			SetupBiggerLungs();
			SetupRunningShoes();
			SetupStrongLegs();
			SetupMalwareBroadcaster();
			SetupNightVisionBattery();
			SetupDiscombobulator();
			SetupBetterScanner();
			SetupWalkieGPS();
			SetupBackMuscles();
			SetupInterns();
			SetupPager();
			SetupLightningRod();
			SetupLocksmith();
			SetupPlayerHealth();
			SetupHunter();
			SetupContract();
			SetupSickBeats();
			SetupExtendDeadline();
			SetupDoorsHydraulicsBattery();
			SetupScrapInsurance();
			SetupMarketInfluence();
			SetupBargainConnections();
			SetupLethalDeals();
			SetupQuantumDisruptor();
		}

		private void SetupSickBeats()
		{
			SetupGenericPerk<SickBeats>("Sick Beats");
		}

		private void SetupContract()
		{
			SetupGenericPerk<ContractScript>("Contract");
		}

		private void SetupBeekeeper()
		{
			SetupGenericPerk<Beekeeper>("Beekeeper");
		}

		private void SetupHunter()
		{
			SetupGenericPerk<Hunter>("Hunter");
		}

		private void SetupProteinPowder()
		{
			SetupGenericPerk<ProteinPowder>("Protein Powder");
		}

		private void SetupBiggerLungs()
		{
			SetupGenericPerk<BiggerLungs>("Bigger Lungs");
		}

		private void SetupRunningShoes()
		{
			SetupGenericPerk<RunningShoes>("Running Shoes");
		}

		private void SetupStrongLegs()
		{
			SetupGenericPerk<StrongLegs>("Strong Legs");
		}

		private void SetupMalwareBroadcaster()
		{
			SetupGenericPerk<MalwareBroadcaster>(MalwareBroadcaster.UPGRADE_NAME);
		}

		private void SetupNightVisionBattery()
		{
			SetupGenericPerk<NightVision>("NV Headset Batteries");
		}

		private void SetupDiscombobulator()
		{
			AudioClip audioClip = AssetBundleHandler.GetAudioClip("Flashbang");
			if ((Object)(object)audioClip != (Object)null)
			{
				UpgradeBus.Instance.flashNoise = audioClip;
			}
			SetupGenericPerk<Discombobulator>("Discombobulator");
		}

		private void SetupBetterScanner()
		{
			SetupGenericPerk<BetterScanner>("Better Scanner");
		}

		private void SetupWalkieGPS()
		{
			SetupGenericPerk<WalkieGPS>("Walkie GPS");
		}

		private void SetupBackMuscles()
		{
			SetupGenericPerk<BackMuscles>("Back Muscles");
		}

		private void SetupInterns()
		{
			SetupGenericPerk<Interns>("Interns");
		}

		private void SetupPager()
		{
			SetupGenericPerk<FastEncryption>("Fast Encryption");
		}

		private void SetupLightningRod()
		{
			SetupGenericPerk<LightningRod>("Lightning Rod");
		}

		private void SetupLocksmith()
		{
			SetupGenericPerk<LockSmith>(LockSmith.UPGRADE_NAME);
		}

		private void SetupPlayerHealth()
		{
			SetupGenericPerk<Stimpack>("Stimpack");
		}

		private void SetupExtendDeadline()
		{
			SetupGenericPerk<ExtendDeadlineScript>(ExtendDeadlineScript.NAME);
		}

		private void SetupDoorsHydraulicsBattery()
		{
			SetupGenericPerk<DoorsHydraulicsBattery>("Shutter Batteries");
		}

		private void SetupScrapInsurance()
		{
			SetupGenericPerk<ScrapInsurance>(ScrapInsurance.COMMAND_NAME);
		}

		private void SetupMarketInfluence()
		{
			SetupGenericPerk<MarketInfluence>("Market Influence");
		}

		private void SetupBargainConnections()
		{
			SetupGenericPerk<BargainConnections>("Bargain Connections");
		}

		private void SetupLethalDeals()
		{
			SetupGenericPerk<LethalDeals>("Lethal Deals");
		}

		private void SetupQuantumDisruptor()
		{
			SetupGenericPerk<QuantumDisruptor>("Quantum Disruptor");
		}

		private void SetupGenericPerk<T>(string upgradeName) where T : Component
		{
			GameObject perkGameObject = AssetBundleHandler.GetPerkGameObject(upgradeName);
			if (Object.op_Implicit((Object)(object)perkGameObject))
			{
				perkGameObject.AddComponent<T>();
				NetworkPrefabs.RegisterNetworkPrefab(perkGameObject);
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MoreShipUpgrades";

		public const string PLUGIN_NAME = "MoreShipUpgrades";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace MoreShipUpgrades.UpgradeComponents.TierUpgrades
{
	internal class BackMuscles : TierUpgrade, IUpgradeWorldBuilding
	{
		internal float alteredWeight = 1f;

		internal static BackMuscles Instance;

		public const string UPGRADE_NAME = "Back Muscles";

		public const string PRICES_DEFAULT = "600,700,800";

		internal const string WORLD_BUILDING_TEXT = "\n\nCompany-issued hydraulic girdles which are only awarded to high-performing {0} who can afford to opt in. Highly valued by all employees of The Company for their combination of miraculous health-preserving benefits and artificial, intentionally-implemented scarcity. Sardonically called the 'Back Muscles Upgrade' by some. Comes with a user manual, which mostly contains minimalistic ads for girdle maintenance contractors. Most of the phone numbers don't work anymore.\n\n";

		private void Awake()
		{
			upgradeName = "Back Muscles";
			Instance = this;
		}

		public override void Increment()
		{
			base.Increment();
			UpdatePlayerWeight();
		}

		public override void Load()
		{
			base.Load();
			UpdatePlayerWeight();
		}

		public override void Unwind()
		{
			base.Unwind();
			UpdatePlayerWeight();
		}

		public static float DecreasePossibleWeight(float defaultWeight)
		{
			if (!BaseUpgrade.GetActiveUpgrade("Back Muscles"))
			{
				return defaultWeight;
			}
			return defaultWeight * (UpgradeBus.Instance.PluginConfiguration.CARRY_WEIGHT_REDUCTION.Value - (float)BaseUpgrade.GetUpgradeLevel("Back Muscles") * UpgradeBus.Instance.PluginConfiguration.CARRY_WEIGHT_INCREMENT.Value);
		}

		public static void UpdatePlayerWeight()
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (localPlayerController.ItemSlots.Length == 0)
			{
				return;
			}
			Instance.alteredWeight = 1f;
			for (int i = 0; i < localPlayerController.ItemSlots.Length; i++)
			{
				GrabbableObject val = localPlayerController.ItemSlots[i];
				if (!((Object)(object)val == (Object)null))
				{
					Instance.alteredWeight += Mathf.Clamp(DecreasePossibleWeight(val.itemProperties.weight - 1f), 0f, 10f);
				}
			}
			localPlayerController.carryWeight = Instance.alteredWeight;
			if (localPlayerController.carryWeight < 1f)
			{
				localPlayerController.carryWeight = 1f;
			}
		}

		public string GetWorldBuildingText(bool shareStatus = false)
		{
			return string.Format("\n\nCompany-issued hydraulic girdles which are only awarded to high-performing {0} who can afford to opt in. Highly valued by all employees of The Company for their combination of miraculous health-preserving benefits and artificial, intentionally-implemented scarcity. Sardonically called the 'Back Muscles Upgrade' by some. Comes with a user manual, which mostly contains minimalistic ads for girdle maintenance contractors. Most of the phone numbers don't work anymore.\n\n", shareStatus ? "departments" : "employees");
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			Func<int, float> infoFunction = (int level) => (UpgradeBus.Instance.PluginConfiguration.CARRY_WEIGHT_REDUCTION.Value - (float)level * UpgradeBus.Instance.PluginConfiguration.CARRY_WEIGHT_INCREMENT.Value) * 100f;
			string infoFromJSON = AssetBundleHandler.GetInfoFromJSON("Back Muscles");
			return Tools.GenerateInfoForUpgrade(infoFromJSON, initialPrice, incrementalPrices, infoFunction);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "BackMuscles";
		}
	}
	internal class BargainConnections : TierUpgrade
	{
		internal const string UPGRADE_NAME = "Bargain Connections";

		internal const string PRICES_DEFAULT = "225,300,375";

		internal override void Start()
		{
			upgradeName = "Bargain Connections";
			base.Start();
		}

		public static int GetBargainConnectionsAdditionalItems(int defaultAmountItems)
		{
			if (!BaseUpgrade.GetActiveUpgrade("Bargain Connections"))
			{
				return defaultAmountItems;
			}
			return defaultAmountItems + UpgradeBus.Instance.PluginConfiguration.BARGAIN_CONNECTIONS_INITIAL_ITEM_AMOUNT.Value + BaseUpgrade.GetUpgradeLevel("Bargain Connections") * UpgradeBus.Instance.PluginConfiguration.BARGAIN_CONNECTIONS_INCREMENTAL_ITEM_AMOUNT.Value;
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			Func<int, float> infoFunction = (int level) => UpgradeBus.Instance.PluginConfiguration.BARGAIN_CONNECTIONS_INITIAL_ITEM_AMOUNT.Value + level * UpgradeBus.Instance.PluginConfiguration.BARGAIN_CONNECTIONS_INCREMENTAL_ITEM_AMOUNT.Value;
			string infoFormat = "LVL {0} - ${1} - Increases the amount of items that can be on sale by {2}\n";
			return Tools.GenerateInfoForUpgrade(infoFormat, initialPrice, incrementalPrices, infoFunction);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "BargainConnections";
		}
	}
	internal class Beekeeper : TierUpgrade, IUpgradeWorldBuilding
	{
		internal bool increaseHivePrice = false;

		internal static Beekeeper Instance;

		public const string UPGRADE_NAME = "Beekeeper";

		public const string PRICES_DEFAULT = "225,280,340";

		internal const string WORLD_BUILDING_TEXT = "\n\nOn-the-job training package that teaches {0} proper Circuit Bee Nest handling techniques. Also comes with a weekly issuance of alkaline pills to partially inoculate {0} against Circuit Bee Venom.\n\n";

		private void Awake()
		{
			upgradeName = "Beekeeper";
			Instance = this;
		}

		public override void Increment()
		{
			base.Increment();
			if (BaseUpgrade.GetUpgradeLevel("Beekeeper") == UpgradeBus.Instance.PluginConfiguration.BEEKEEPER_UPGRADE_PRICES.Value.Split(',').Length)
			{
				ToggleIncreaseHivePriceServerRpc();
			}
		}

		public static int CalculateBeeDamage(int damageNumber)
		{
			if (!BaseUpgrade.GetActiveUpgrade("Beekeeper"))
			{
				return damageNumber;
			}
			return Mathf.Clamp((int)((float)damageNumber * (UpgradeBus.Instance.PluginConfiguration.BEEKEEPER_DAMAGE_MULTIPLIER.Value - (float)BaseUpgrade.GetUpgradeLevel("Beekeeper") * UpgradeBus.Instance.PluginConfiguration.BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT.Value)), 0, damageNumber);
		}

		public static int GetHiveScrapValue(int originalValue)
		{
			if (!UpgradeBus.Instance.PluginConfiguration.BEEKEEPER_ENABLED.Value || !Instance.increaseHivePrice)
			{
				return originalValue;
			}
			return (int)((float)originalValue * UpgradeBus.Instance.PluginConfiguration.BEEKEEPER_HIVE_VALUE_INCREASE.Value);
		}

		public string GetWorldBuildingText(bool shareStatus = false)
		{
			return string.Format("\n\nOn-the-job training package that teaches {0} proper Circuit Bee Nest handling techniques. Also comes with a weekly issuance of alkaline pills to partially inoculate {0} against Circuit Bee Venom.\n\n", shareStatus ? "your crew" : "you");
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			Func<int, float> infoFunction = (int level) => 100f * (UpgradeBus.Instance.PluginConfiguration.BEEKEEPER_DAMAGE_MULTIPLIER.Value - (float)level * UpgradeBus.Instance.PluginConfiguration.BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT.Value);
			string infoFromJSON = AssetBundleHandler.GetInfoFromJSON("Beekeeper");
			return Tools.GenerateInfoForUpgrade(infoFromJSON, initialPrice, incrementalPrices, infoFunction);
		}

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

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

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

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

		private static void __rpc_handler_3970566516(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;
				((Beekeeper)(object)target).ToggleIncreaseHivePriceServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_708329620(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Beekeeper)(object)target).ToggleIncreaseHivePriceClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "Beekeeper";
		}
	}
	internal class BetterScanner : TierUpgrade, IUpgradeWorldBuilding
	{
		public const string UPGRADE_NAME = "Better Scanner";

		internal const string WORLD_BUILDING_TEXT = "\n\nA serialized Company-Issue Magazine subscription, called 'Stuff Finders'. Uniquely, {0} must subscribe to each issue of 'Stuff Finders' individually. Each separate subscription promises and delivers a weekly issuance of a magazine with the exact same information in it as last time, organized in a different order and with slightly different printing qualities each time. There are only three 'unique' issues, and each issue only has one or two pieces of actual useful information in it. The rest of the magazine is just ads for The Company's other offerings. There is an extra fee for cancelling a subscription of 'Stuff Finders' before terminating your employment. The useful information always comes in the form of an unlabelled service key or Ship terminal hyperlink.\n\n";

		private static LguLogger logger = new LguLogger("Better Scanner");

		internal override void Start()
		{
			upgradeName = "Better Scanner";
			base.Start();
		}

		public static void AddScannerNodeToValve(ref SteamValveHazard steamValveHazard)
		{
			if (BaseUpgrade.GetActiveUpgrade("Better Scanner"))
			{
				logger.LogDebug("Inserting a Scan Node on a broken steam valve...");
				LguScanNodeProperties.AddGeneralScanNode(((Component)steamValveHazard).gameObject, "Bursted Steam Valve", "Fix it to get rid of the steam", -1, 3);
			}
		}

		public static void RemoveScannerNodeFromValve(ref SteamValveHazard steamValveHazard)
		{
			logger.LogDebug("Removing the Scan Node from a fixed steam valve...");
			LguScanNodeProperties.RemoveScanNode(((Component)steamValveHazard).gameObject);
		}

		public static string GetBetterScannerInfo(int level, int price)
		{
			switch (level)
			{
			case 1:
				return string.Format(AssetBundleHandler.GetInfoFromJSON("Better Scanner1"), level, price, UpgradeBus.Instance.PluginConfiguration.NODE_DISTANCE_INCREASE.Value, UpgradeBus.Instance.PluginConfiguration.SHIP_AND_ENTRANCE_DISTANCE_INCREASE.Value);
			case 2:
				return string.Format(AssetBundleHandler.GetInfoFromJSON("Better Scanner2"), level, price);
			case 3:
			{
				string text = string.Format(AssetBundleHandler.GetInfoFromJSON("Better Scanner3"), level, price, UpgradeBus.Instance.PluginConfiguration.BETTER_SCANNER_ENEMIES.Value ? " and enemies" : "");
				return text + "hives and scrap command display the location of the most valuable hives and scrap on the map.\n";
			}
			default:
				return "";
			}
		}

		public string GetWorldBuildingText(bool shareStatus = false)
		{
			return string.Format("\n\nA serialized Company-Issue Magazine subscription, called 'Stuff Finders'. Uniquely, {0} must subscribe to each issue of 'Stuff Finders' individually. Each separate subscription promises and delivers a weekly issuance of a magazine with the exact same information in it as last time, organized in a different order and with slightly different printing qualities each time. There are only three 'unique' issues, and each issue only has one or two pieces of actual useful information in it. The rest of the magazine is just ads for The Company's other offerings. There is an extra fee for cancelling a subscription of 'Stuff Finders' before terminating your employment. The useful information always comes in the form of an unlabelled service key or Ship terminal hyperlink.\n\n", shareStatus ? "a department" : "one");
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(GetBetterScannerInfo(1, initialPrice));
			for (int i = 0; i < maxLevels; i++)
			{
				stringBuilder.Append(GetBetterScannerInfo(i + 2, incrementalPrices[i]));
			}
			return stringBuilder.ToString();
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "BetterScanner";
		}
	}
	internal class Discombobulator : TierUpgrade, IUpgradeWorldBuilding
	{
		internal float flashCooldown = 0f;

		private static LguLogger logger = new LguLogger("Discombobulator");

		public static Discombobulator instance;

		public const string UPGRADE_NAME = "Discombobulator";

		public const string PRICES_DEFAULT = "330,460,620";

		internal const string WORLD_BUILDING_TEXT = "\n\nService key for the Ship's terminal which allows {0} to legally use the Ship's 'Discombobulator' module. Comes with a list of opt-in maintenance procedures that promise to optimze the discharge and refractory of the system. Said document contains no mention of whatever it might be that it was included in the Ship's design to discombobulate.\n\n";

		private void Awake()
		{
			upgradeName = "Discombobulator";
			instance = this;
		}

		private void Update()
		{
			if (flashCooldown > 0f)
			{
				flashCooldown -= Time.deltaTime;
			}
		}

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

		[ClientRpc]
		private void PlayAudioAndUpdateCooldownClientRpc()
		{
			//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_011c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1866209176u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1866209176u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Terminal terminal = UpgradeBus.Instance.GetTerminal();
			terminal.terminalAudio.maxDistance = 100f;
			terminal.terminalAudio.PlayOneShot(UpgradeBus.Instance.flashNoise);
			((MonoBehaviour)this).StartCoroutine(ResetRange(terminal));
			flashCooldown = UpgradeBus.Instance.PluginConfiguration.DISCOMBOBULATOR_COOLDOWN.Value;
			Collider[] array = Physics.OverlapSphere(((Component)terminal).transform.position, UpgradeBus.Instance.PluginConfiguration.DISCOMBOBULATOR_RADIUS.Value, 524288);
			if (array.Length == 0)
			{
				return;
			}
			for (int i = 0; i < array.Length; i++)
			{
				EnemyAICollisionDetect component = ((Component)array[i]).GetComponent<EnemyAICollisionDetect>();
				if (!((Object)(object)component == (Object)null))
				{
					EnemyAI mainScript = component.mainScript;
					if (CanDealDamage())
					{
						int num = UpgradeBus.Instance.PluginConfiguration.DISCOMBOBULATOR_INITIAL_DAMAGE.Value + UpgradeBus.Instance.PluginConfiguration.DISCOMBOBULATOR_DAMAGE_INCREASE.Value * (BaseUpgrade.GetUpgradeLevel("Discombobulator") - UpgradeBus.Instance.PluginConfiguration.DISCOMBOBULATOR_DAMAGE_LEVEL.Value);
						mainScript.HitEnemy(num, (PlayerControllerB)null, false);
					}
					if (!mainScript.isEnemyDead)
					{
						mainScript.SetEnemyStunned(true, UpgradeBus.Instance.PluginConfiguration.DISCOMBOBULATOR_STUN_DURATION.Value + UpgradeBus.Instance.PluginConfiguration.DISCOMBOBULATOR_INCREMENT.Value * (float)BaseUpgrade.GetUpgradeLevel("Discombobulator"), (PlayerControllerB)null);
					}
				}
			}
		}

		private bool CanDealDamage()
		{
			return UpgradeBus.Instance.PluginConfiguration.DISCOMBOBULATOR_DAMAGE_LEVEL.Value > 0 && BaseUpgrade.GetUpgradeLevel("Discombobulator") + 1 >= UpgradeBus.Instance.PluginConfiguration.DISCOMBOBULATOR_DAMAGE_LEVEL.Value;
		}

		private IEnumerator ResetRange(Terminal terminal)
		{
			yield return (object)new WaitForSeconds(2f);
			terminal.terminalAudio.maxDistance = 17f;
		}

		public string GetWorldBuildingText(bool shareStatus = false)
		{
			return string.Format("\n\nService key for the Ship's terminal which allows {0} to legally use the Ship's 'Discombobulator' module. Comes with a list of opt-in maintenance procedures that promise to optimze the discharge and refractory of the system. Said document contains no mention of whatever it might be that it was included in the Ship's design to discombobulate.\n\n", shareStatus ? "your crew" : "you");
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			Func<int, float> infoFunction = (int level) => UpgradeBus.Instance.PluginConfiguration.DISCOMBOBULATOR_STUN_DURATION.Value + (float)level * UpgradeBus.Instance.PluginConfiguration.DISCOMBOBULATOR_INCREMENT.Value;
			string infoFromJSON = AssetBundleHandler.GetInfoFromJSON("Discombobulator");
			return Tools.GenerateInfoForUpgrade(infoFromJSON, initialPrice, incrementalPrices, infoFunction);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

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

		private static void __rpc_handler_2657042876(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;
				((Discombobulator)(object)target).PlayAudioAndUpdateCooldownServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1866209176(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Discombobulator)(object)target).PlayAudioAndUpdateCooldownClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "Discombobulator";
		}
	}
	internal class Hunter : TierUpgrade, IUpgradeWorldBuilding
	{
		private static LguLogger logger = new LguLogger("Hunter");

		internal static Hunter Instance;

		public const string UPGRADE_NAME = "Hunter";

		internal const string WORLD_BUILDING_TEXT = "\n\nOn-the-job training program that teaches your crew how to properly collect lab-ready samples of blood, skin, and organ tissue from entities found within the facility. These samples are valuable to The Company. Used to be a part of the standard onboarding procedure, but was made opt-in only in 2005 to cut onboarding costs.\n\n";

		private static Dictionary<string, string> monsterNames = new Dictionary<string, string>
		{
			{ "hoarding", "Hoarding Bug" },
			{ "hoarding bug", "Hoarding Bug" },
			{ "snare", "Snare Flea" },
			{ "flea", "Snare Flea" },
			{ "snare flea", "Snare Flea" },
			{ "centipede", "Snare Flea" },
			{ "bunker spider", "Bunker Spider" },
			{ "bunker", "Bunker Spider" },
			{ "bunk", "Bunker Spider" },
			{ "spider", "Bunker Spider" },
			{ "baboon hawk", "Baboon Hawk" },
			{ "baboon", "Baboon Hawk" },
			{ "hawk", "Baboon Hawk" },
			{ "flowerman", "Bracken" },
			{ "bracken", "Bracken" },
			{ "crawler", "Half/Thumper" },
			{ "half", "Half/Thumper" },
			{ "thumper", "Half/Thumper" },
			{ "mouthdog", "Eyeless Dog" },
			{ "eyeless dog", "Eyeless Dog" },
			{ "eyeless", "Eyeless Dog" },
			{ "dog", "Eyeless Dog" }
		};

		public static Dictionary<int, string[]> tiers;

		public static void SetupTierList()
		{
			logger = new LguLogger("Hunter");
			tiers = new Dictionary<int, string[]>();
			string[] array = UpgradeBus.Instance.PluginConfiguration.HUNTER_SAMPLE_TIERS.Value.ToLower().Split('-');
			tiers[0] = (from x in array[0].Split(",")
				select x.Trim()).ToArray();
			for (int i = 1; i < array.Length; i++)
			{
				tiers[i] = tiers[i - 1].Concat(from x in array[i].Split(",")
					select x.Trim()).ToArray();
			}
		}

		private void Awake()
		{
			upgradeName = "Hunter";
			Instance = this;
		}

		public static string GetHunterInfo(int level, int price)
		{
			string text = ((level == 1) ? string.Join(", ", tiers[level - 1]) : string.Join(", ", tiers[level - 1].Except(tiers[level - 2]).ToArray()));
			string text2 = "";
			string[] array = text.Split(", ");
			foreach (string text3 in array)
			{
				logger.LogDebug(text3.Trim().ToLower());
				logger.LogDebug(monsterNames[text3.Trim().ToLower()]);
				text2 = text2 + monsterNames[text3.Trim().ToLower()] + ", ";
			}
			text2 = text2.Substring(0, text2.Length - 2);
			text2 += "\n";
			return string.Format(AssetBundleHandler.GetInfoFromJSON("Hunter"), level, price, text2);
		}

		public string GetWorldBuildingText(bool shareStatus = false)
		{
			return "\n\nOn-the-job training program that teaches your crew how to properly collect lab-ready samples of blood, skin, and organ tissue from entities found within the facility. These samples are valuable to The Company. Used to be a part of the standard onboarding procedure, but was made opt-in only in 2005 to cut onboarding costs.\n\n";
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			string text = GetHunterInfo(1, initialPrice);
			for (int i = 0; i < maxLevels; i++)
			{
				text += GetHunterInfo(i + 2, incrementalPrices[i]);
			}
			return text;
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "Hunter";
		}
	}
	internal class MarketInfluence : TierUpgrade
	{
		internal const string UPGRADE_NAME = "Market Influence";

		internal const string PRICES_DEFAULT = "200,350,500";

		internal override void Start()
		{
			upgradeName = "Market Influence";
			base.Start();
		}

		public static int GetGuaranteedPercentageSale(int defaultPercentage, int maxValue)
		{
			if (!BaseUpgrade.GetActiveUpgrade("Market Influence"))
			{
				return defaultPercentage;
			}
			return Mathf.Clamp(defaultPercentage + UpgradeBus.Instance.PluginConfiguration.MARKET_INFLUENCE_INITIAL_PERCENTAGE.Value + BaseUpgrade.GetUpgradeLevel("Market Influence") * UpgradeBus.Instance.PluginConfiguration.MARKET_INFLUENCE_INCREMENTAL_PERCENTAGE.Value, 0, maxValue);
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			Func<int, float> infoFunction = (int level) => UpgradeBus.Instance.PluginConfiguration.MARKET_INFLUENCE_INITIAL_PERCENTAGE.Value + level * UpgradeBus.Instance.PluginConfiguration.MARKET_INFLUENCE_INCREMENTAL_PERCENTAGE.Value;
			string infoFormat = "LVL {0} - ${1} - Guarantees the item sales' percentage to be at least {2}%\n";
			return Tools.GenerateInfoForUpgrade(infoFormat, initialPrice, incrementalPrices, infoFunction);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "MarketInfluence";
		}
	}
	internal class NightVision : TierUpgrade
	{
		private float nightBattery;

		private Transform batteryBar;

		private PlayerControllerB client;

		public bool batteryExhaustion;

		internal GameObject nightVisionPrefab;

		internal bool nightVisionActive = false;

		internal float nightVisRange;

		internal float nightVisIntensity;

		internal Color nightVisColor;

		public const string UPGRADE_NAME = "NV Headset Batteries";

		public const string PRICES_DEFAULT = "300,400,500";

		private static LguLogger logger = new LguLogger("NV Headset Batteries");

		public static NightVision Instance { get; internal set; }

		private void Awake()
		{
			Instance = this;
			upgradeName = "NV Headset Batteries";
			nightVisionPrefab = AssetBundleHandler.GetItemObject("Night Vision").spawnPrefab;
		}

		internal override void Start()
		{
			base.Start();
			batteryBar = ((Component)((Component)this).transform.GetChild(0).GetChild(0)).transform;
			((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false);
		}

		private void LateUpdate()
		{
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)client == (Object)null)
			{
				return;
			}
			float num = UpgradeBus.Instance.PluginConfiguration.NIGHT_BATTERY_MAX.Value + (float)BaseUpgrade.GetUpgradeLevel("NV Headset Batteries") * UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_BATTERY_INCREMENT.Value;
			if (nightVisionActive)
			{
				nightBattery -= Time.deltaTime * (UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_DRAIN_SPEED.Value - (float)BaseUpgrade.GetUpgradeLevel("NV Headset Batteries") * UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_DRAIN_INCREMENT.Value);
				nightBattery = Mathf.Clamp(nightBattery, 0f, num);
				((Component)batteryBar.parent).gameObject.SetActive(true);
				if (nightBattery <= 0f)
				{
					TurnOff(exhaust: true);
				}
			}
			else if (!batteryExhaustion)
			{
				nightBattery += Time.deltaTime * (UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_REGEN_SPEED.Value + (float)BaseUpgrade.GetUpgradeLevel("NV Headset Batteries") * UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_REGEN_INCREMENT.Value);
				nightBattery = Mathf.Clamp(nightBattery, 0f, num);
				if (nightBattery >= num)
				{
					((Component)batteryBar.parent).gameObject.SetActive(false);
				}
				else
				{
					((Component)batteryBar.parent).gameObject.SetActive(true);
				}
			}
			if (client.isInsideFactory || nightVisionActive)
			{
				((Behaviour)client.nightVision).enabled = true;
			}
			else
			{
				((Behaviour)client.nightVision).enabled = false;
			}
			float num2 = nightBattery / num;
			batteryBar.localScale = new Vector3(num2, 1f, 1f);
		}

		public void Toggle()
		{
			if (BaseUpgrade.GetActiveUpgrade("NV Headset Batteries"))
			{
				nightVisionActive = !nightVisionActive;
				if ((Object)(object)client == (Object)null)
				{
					client = GameNetworkManager.Instance.localPlayerController;
				}
				if (nightVisionActive)
				{
					TurnOn();
				}
				else
				{
					TurnOff();
				}
			}
		}

		private void TurnOff(bool exhaust = false)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			nightVisionActive = false;
			client.nightVision.color = nightVisColor;
			client.nightVision.range = nightVisRange;
			client.nightVision.intensity = nightVisIntensity;
			if (exhaust)
			{
				batteryExhaustion = true;
				((MonoBehaviour)this).StartCoroutine(BatteryRecovery());
			}
		}

		private void TurnOn()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			nightVisColor = client.nightVision.color;
			nightVisRange = client.nightVision.range;
			nightVisIntensity = client.nightVision.intensity;
			client.nightVision.color = UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_COLOR.Value;
			client.nightVision.range = UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_RANGE.Value + (float)BaseUpgrade.GetUpgradeLevel("NV Headset Batteries") * UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_RANGE_INCREMENT.Value;
			client.nightVision.intensity = UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_INTENSITY.Value + (float)BaseUpgrade.GetUpgradeLevel("NV Headset Batteries") * UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_INTENSITY_INCREMENT.Value;
			nightBattery -= UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_STARTUP.Value;
		}

		private IEnumerator BatteryRecovery()
		{
			yield return (object)new WaitForSeconds(UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_EXHAUST.Value);
			batteryExhaustion = false;
		}

		public override void Increment()
		{
			base.Increment();
			LguStore.Instance.UpdateLGUSaveServerRpc(GameNetworkManager.Instance.localPlayerController.playerSteamId, JsonConvert.SerializeObject((object)new SaveInfo()));
		}

		public override void Load()
		{
			base.Load();
			EnableOnClient(save: false);
		}

		public override void Unwind()
		{
			base.Unwind();
			DisableOnClient();
		}

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

		[ClientRpc]
		private void EnableNightVisionClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3091963562u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3091963562u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					logger.LogDebug("Request to enable night vision on this client received.");
					EnableOnClient();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnNightVisionItemOnDeathServerRpc(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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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(2325508725u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2325508725u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					GameObject val3 = Object.Instantiate<GameObject>(nightVisionPrefab, position + Vector3.up, Quaternion.identity);
					val3.GetComponent<NetworkObject>().Spawn(false);
					logger.LogInfo("Request to spawn night vision goggles received.");
				}
			}
		}

		public void EnableOnClient(bool save = true)
		{
			if ((Object)(object)client == (Object)null)
			{
				client = GameNetworkManager.Instance.localPlayerController;
			}
			((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(true);
			UpgradeBus.Instance.activeUpgrades["NV Headset Batteries"] = true;
			if (save)
			{
				LguStore.Instance.UpdateLGUSaveServerRpc(client.playerSteamId, JsonConvert.SerializeObject((object)new SaveInfo()));
			}
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Press " + UpgradeBus.Instance.PluginConfiguration.TOGGLE_NIGHT_VISION_KEY.Value + " to toggle Night Vision!!!</color>";
		}

		public void DisableOnClient()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			nightVisionActive = false;
			client.nightVision.color = nightVisColor;
			client.nightVision.range = nightVisRange;
			client.nightVision.intensity = nightVisIntensity;
			((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false);
			UpgradeBus.Instance.activeUpgrades["NV Headset Batteries"] = false;
			LguStore.Instance.UpdateLGUSaveServerRpc(client.playerSteamId, JsonConvert.SerializeObject((object)new SaveInfo()));
			client = null;
		}

		public static string GetNightVisionInfo(int level, int price)
		{
			if (level == 1)
			{
				float num = (UpgradeBus.Instance.PluginConfiguration.NIGHT_BATTERY_MAX.Value - UpgradeBus.Instance.PluginConfiguration.NIGHT_BATTERY_MAX.Value * UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_STARTUP.Value) / UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_DRAIN_SPEED.Value;
				float num2 = UpgradeBus.Instance.PluginConfiguration.NIGHT_BATTERY_MAX.Value / UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_REGEN_SPEED.Value;
				return string.Format(AssetBundleHandler.GetInfoFromJSON("NV Headset Batteries"), level, price, num, num2);
			}
			float num3 = Mathf.Clamp(UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_REGEN_SPEED.Value + UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_REGEN_INCREMENT.Value * (float)(level - 1), 0f, 1000f);
			float num4 = Mathf.Clamp(UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_DRAIN_SPEED.Value - UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_DRAIN_INCREMENT.Value * (float)(level - 1), 0f, 1000f);
			float num5 = UpgradeBus.Instance.PluginConfiguration.NIGHT_BATTERY_MAX.Value + UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_BATTERY_INCREMENT.Value * (float)(level - 1);
			string text = "infinite";
			if (num4 != 0f)
			{
				text = ((num5 - num5 * UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_STARTUP.Value) / num4).ToString("F2");
			}
			string text2 = "infinite";
			if (num3 != 0f)
			{
				text2 = (num5 / num3).ToString("F2");
			}
			return string.Format(AssetBundleHandler.GetInfoFromJSON("NV Headset Batteries"), level, price, text, text2);
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(GetNightVisionInfo(1, initialPrice));
			for (int i = 0; i < maxLevels; i++)
			{
				stringBuilder.Append(GetNightVisionInfo(i + 2, incrementalPrices[i]));
			}
			return stringBuilder.ToString();
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_NightVision()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1013472646u, new RpcReceiveHandler(__rpc_handler_1013472646));
			NetworkManager.__rpc_func_table.Add(3091963562u, new RpcReceiveHandler(__rpc_handler_3091963562));
			NetworkManager.__rpc_func_table.Add(2325508725u, new RpcReceiveHandler(__rpc_handler_2325508725));
		}

		private static void __rpc_handler_1013472646(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;
				((NightVision)(object)target).EnableNightVisionServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3091963562(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((NightVision)(object)target).EnableNightVisionClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2325508725(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;
				((NightVision)(object)target).SpawnNightVisionItemOnDeathServerRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "NightVision";
		}
	}
	internal class ProteinPowder : TierUpgrade, IUpgradeWorldBuilding
	{
		public const string UPGRADE_NAME = "Protein Powder";

		internal const string WORLD_BUILDING_TEXT = "\n\nMultivitamins, creatine, and military surplus stimulants blended together and repackaged, then offered on subscription. Known to be habit-forming. The label includes a Company Surgeon General's warning about increased aggression.\n\n";

		private static int CRIT_DAMAGE_VALUE = 100;

		public const string ENABLED_SECTION = "Enable Protein Powder Upgrade";

		public const bool ENABLED_DEFAULT = true;

		public const string ENABLED_DESCRIPTION = "Do more damage with shovels";

		public const string PRICE_SECTION = "Price of Protein Powder Upgrade";

		public const int PRICE_DEFAULT = 1000;

		public const string UNLOCK_FORCE_SECTION = "Initial additional hit force";

		public const int UNLOCK_FORCE_DEFAULT = 1;

		public const string UNLOCK_FORCE_DESCRIPTION = "The value added to hit force on initial unlock.";

		public const string INCREMENT_FORCE_SECTION = "Additional hit force per level";

		public const int INCREMENT_FORCE_DEFAULT = 1;

		public const string INCREMENT_FORCE_DESCRIPTION = "Every time Protein Powder is upgraded this value will be added to the value above.";

		public const string PRICES_DEFAULT = "700";

		public const string CRIT_CHANCE_SECTION = "Chance of dealing a crit which will instakill the enemy.";

		public const float CRIT_CHANCE_DEFAULT = 0.01f;

		public const string CRIT_CHANCE_DESCRIPTION = "This value is only valid when maxed out Protein Powder. Any previous levels will not apply crit.";

		internal override void Start()
		{
			upgradeName = "Protein Powder";
			base.Start();
		}

		public static int GetShovelHitForce(int force)
		{
			if (!UpgradeBus.Instance.PluginConfiguration.PROTEIN_ENABLED.Value)
			{
				return force;
			}
			if (!BaseUpgrade.GetActiveUpgrade("Protein Powder"))
			{
				return force;
			}
			int num = (TryToCritEnemy() ? CRIT_DAMAGE_VALUE : (UpgradeBus.Instance.PluginConfiguration.PROTEIN_UNLOCK_FORCE.Value + UpgradeBus.Instance.PluginConfiguration.PROTEIN_INCREMENT.Value * BaseUpgrade.GetUpgradeLevel("Protein Powder")));
			return force + num;
		}

		private static bool TryToCritEnemy()
		{
			int num = UpgradeBus.Instance.PluginConfiguration.PROTEIN_UPGRADE_PRICES.Value.Split(',').Length;
			int upgradeLevel = BaseUpgrade.GetUpgradeLevel("Protein Powder");
			if (upgradeLevel != num)
			{
				return false;
			}
			return Random.value < UpgradeBus.Instance.PluginConfiguration.PROTEIN_CRIT_CHANCE.Value;
		}

		public string GetWorldBuildingText(bool shareStatus = false)
		{
			return "\n\nMultivitamins, creatine, and military surplus stimulants blended together and repackaged, then offered on subscription. Known to be habit-forming. The label includes a Company Surgeon General's warning about increased aggression.\n\n";
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			Func<int, float> infoFunction = (int level) => UpgradeBus.Instance.PluginConfiguration.PROTEIN_UNLOCK_FORCE.Value + 1 + UpgradeBus.Instance.PluginConfiguration.PROTEIN_INCREMENT.Value * level;
			string infoFromJSON = AssetBundleHandler.GetInfoFromJSON("Protein Powder");
			return Tools.GenerateInfoForUpgrade(infoFromJSON, initialPrice, incrementalPrices, infoFunction);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "ProteinPowder";
		}
	}
}
namespace MoreShipUpgrades.UpgradeComponents.TierUpgrades.AttributeUpgrades
{
	internal class BiggerLungs : GameAttributeTierUpgrade, IUpgradeWorldBuilding, IPlayerSync
	{
		public const string UPGRADE_NAME = "Bigger Lungs";

		public static string PRICES_DEFAULT = "350,450,550";

		internal const string WORLD_BUILDING_TEXT = "\n\nService package for {0}. Opting into every maintenance procedure will arrange for your suit's pipes to be cleaned and repaired, filters re-issued, and DRM removed from the integrated air conditioning system.\n\n";

		private void Awake()
		{
			upgradeName = "Bigger Lungs";
			logger = new LguLogger("Bigger Lungs");
			changingAttribute = GameAttribute.PLAYER_SPRINT_TIME;
			initialValue = UpgradeBus.Instance.PluginConfiguration.SPRINT_TIME_INCREASE_UNLOCK.Value;
			incrementalValue = UpgradeBus.Instance.PluginConfiguration.SPRINT_TIME_INCREMENT.Value;
		}

		public static float ApplyPossibleIncreasedStaminaRegen(float regenValue)
		{
			if (!UpgradeBus.Instance.PluginConfiguration.BIGGER_LUNGS_ENABLED.Value)
			{
				return regenValue;
			}
			if (!BaseUpgrade.GetActiveUpgrade("Bigger Lungs") || BaseUpgrade.GetUpgradeLevel("Bigger Lungs") < 0)
			{
				return regenValue;
			}
			return regenValue * UpgradeBus.Instance.PluginConfiguration.BIGGER_LUNGS_STAMINA_REGEN_INCREASE.Value;
		}

		public static float ApplyPossibleReducedJumpStaminaCost(float jumpCost)
		{
			if (!UpgradeBus.Instance.PluginConfiguration.BIGGER_LUNGS_ENABLED.Value)
			{
				return jumpCost;
			}
			if (!BaseUpgrade.GetActiveUpgrade("Bigger Lungs") || BaseUpgrade.GetUpgradeLevel("Bigger Lungs") < 1)
			{
				return jumpCost;
			}
			return jumpCost * UpgradeBus.Instance.PluginConfiguration.BIGGER_LUNGS_JUMP_STAMINA_COST_DECREASE.Value;
		}

		public string GetWorldBuildingText(bool shareStatus = false)
		{
			return string.Format("\n\nService package for {0}. Opting into every maintenance procedure will arrange for your suit's pipes to be cleaned and repaired, filters re-issued, and DRM removed from the integrated air conditioning system.\n\n", shareStatus ? "your crew's suit oxigen delivery systems" : "your suit's oxygen delivery system");
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			Func<int, float> infoFunction = (int level) => UpgradeBus.Instance.PluginConfiguration.SPRINT_TIME_INCREASE_UNLOCK.Value + (float)level * UpgradeBus.Instance.PluginConfiguration.SPRINT_TIME_INCREMENT.Value;
			string infoFromJSON = AssetBundleHandler.GetInfoFromJSON("Bigger Lungs");
			return Tools.GenerateInfoForUpgrade(infoFromJSON, initialPrice, incrementalPrices, infoFunction);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "BiggerLungs";
		}
	}
	internal class DoorsHydraulicsBattery : GameAttributeTierUpgrade, IServerSync
	{
		public const string UPGRADE_NAME = "Shutter Batteries";

		public const string PRICES_DEFAULT = "200,300,400";

		public const string ENABLED_SECTION = "Enable Shutter Batteries";

		public const string ENABLED_DESCRIPTION = "Increases the amount of time the doors can remain shut";

		public const string PRICE_SECTION = "Price of Shutter Batteries";

		public const int PRICE_DEFAULT = 300;

		public const string INITIAL_SECTION = "Initial battery boost";

		public const float INITIAL_DEFAULT = 5f;

		public const string INITIAL_DESCRIPTION = "Initial battery boost for the doors' lock on first purchase";

		public const string INCREMENTAL_SECTION = "Incremental battery boost";

		public const float INCREMENTAL_DEFAULT = 5f;

		public const string INCREMENTAL_DESCRIPTION = "Incremental battery boost for the doors' lock after purchase";

		private void Awake()
		{
			upgradeName = "Shutter Batteries";
			logger = new LguLogger(upgradeName);
			changingAttribute = GameAttribute.SHIP_DOOR_BATTERY;
			initialValue = UpgradeBus.Instance.PluginConfiguration.DOOR_HYDRAULICS_BATTERY_INITIAL.Value;
			incrementalValue = UpgradeBus.Instance.PluginConfiguration.DOOR_HYDRAULICS_BATTERY_INCREMENTAL.Value;
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			Func<int, float> infoFunction = (int level) => UpgradeBus.Instance.PluginConfiguration.DOOR_HYDRAULICS_BATTERY_INITIAL.Value + (float)level * UpgradeBus.Instance.PluginConfiguration.DOOR_HYDRAULICS_BATTERY_INCREMENTAL.Value;
			string infoFormat = "LVL {0} - ${1} - Increases the door's hydraulic capacity to remain closed by {2} units\n";
			return Tools.GenerateInfoForUpgrade(infoFormat, initialPrice, incrementalPrices, infoFunction);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "DoorsHydraulicsBattery";
		}
	}
	internal class QuantumDisruptor : GameAttributeTierUpgrade, IServerSync
	{
		internal const string UPGRADE_NAME = "Quantum Disruptor";

		internal const string PRICES_DEFAULT = "1200,1500,1800";

		private void Awake()
		{
			upgradeName = "Quantum Disruptor";
			logger = new LguLogger("Quantum Disruptor");
			changingAttribute = GameAttribute.TIME_GLOBAL_TIME_MULTIPLIER;
			initialValue = UpgradeBus.Instance.PluginConfiguration.QUANTUM_DISRUPTOR_INITIAL_MULTIPLIER.Value;
			incrementalValue = UpgradeBus.Instance.PluginConfiguration.QUANTUM_DISRUPTOR_INCREMENTAL_MULTIPLIER.Value;
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			Func<int, float> infoFunction = (int level) => (1f - (UpgradeBus.Instance.PluginConfiguration.QUANTUM_DISRUPTOR_INITIAL_MULTIPLIER.Value + (float)level * UpgradeBus.Instance.PluginConfiguration.QUANTUM_DISRUPTOR_INCREMENTAL_MULTIPLIER.Value)) * 100f;
			string infoFormat = "LVL {0} - ${1} - Decreases the landed moon's rotation force (time passing) by {2}%\n";
			return Tools.GenerateInfoForUpgrade(infoFormat, initialPrice, incrementalPrices, infoFunction);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "QuantumDisruptor";
		}
	}
	internal class RunningShoes : GameAttributeTierUpgrade, IUpgradeWorldBuilding, IPlayerSync
	{
		public const string UPGRADE_NAME = "Running Shoes";

		public static string PRICES_DEFAULT = "500,750,1000";

		internal const string WORLD_BUILDING_TEXT = "\n\nA new pair of boots {0} a whole new lease on life. In this instance, it might also result in fewer wet sock incidents and consequent trenchfoot. After all, who knows how many people have walked in {1} shoes?\n\n";

		private void Awake()
		{
			upgradeName = "Running Shoes";
			logger = new LguLogger("Running Shoes");
			changingAttribute = GameAttribute.PLAYER_MOVEMENT_SPEED;
			initialValue = UpgradeBus.Instance.PluginConfiguration.MOVEMENT_SPEED_UNLOCK.Value;
			incrementalValue = UpgradeBus.Instance.PluginConfiguration.MOVEMENT_INCREMENT.Value;
		}

		public static float ApplyPossibleReducedNoiseRange(float defaultValue)
		{
			if (!BaseUpgrade.GetActiveUpgrade("Running Shoes") || BaseUpgrade.GetUpgradeLevel("Running Shoes") != UpgradeBus.Instance.PluginConfiguration.RUNNING_SHOES_UPGRADE_PRICES.Value.Split(',').Length)
			{
				return defaultValue;
			}
			return Mathf.Clamp(defaultValue - UpgradeBus.Instance.PluginConfiguration.NOISE_REDUCTION.Value, 0f, defaultValue);
		}

		public string GetWorldBuildingText(bool shareStatus = false)
		{
			return string.Format("\n\nA new pair of boots {0} a whole new lease on life. In this instance, it might also result in fewer wet sock incidents and consequent trenchfoot. After all, who knows how many people have walked in {1} shoes?\n\n", shareStatus ? "could give your crew" : "can give you", shareStatus ? "y'all's" : "your");
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			Func<int, float> infoFunction = (int level) => UpgradeBus.Instance.PluginConfiguration.MOVEMENT_SPEED_UNLOCK.Value + (float)level * UpgradeBus.Instance.PluginConfiguration.MOVEMENT_INCREMENT.Value;
			string infoFromJSON = AssetBundleHandler.GetInfoFromJSON("Running Shoes");
			return Tools.GenerateInfoForUpgrade(infoFromJSON, initialPrice, incrementalPrices, infoFunction);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "RunningShoes";
		}
	}
	internal class Stimpack : GameAttributeTierUpgrade, IUpgradeWorldBuilding, IPlayerSync
	{
		internal Dictionary<ulong, int> playerHealthLevels = new Dictionary<ulong, int>();

		internal static Stimpack Instance;

		public const string UPGRADE_NAME = "Stimpack";

		internal const string WORLD_BUILDING_TEXT = "\n\nAn experimental Company-offered 'health treatment' program advertised only on old, peeling Ship posters, which are themselves only present in about 40% of all Company-issued Ships. Some Ships even have multiple. Nothing is known from the outside about how it works, and in order to be eligible for the program, {0} must sign an NDA.\n\n";

		public const string ENABLED_SECTION = "Enable Stimpack Upgrade";

		public const bool ENABLED_DEFAULT = true;

		public const string ENABLED_DESCRIPTION = "Increases player's health.";

		public const string PRICE_SECTION = "Stimpack Price";

		public const int PRICE_DEFAULT = 600;

		public const string PRICES_DEFAULT = "300, 450, 600";

		public const string ADDITIONAL_HEALTH_UNLOCK_SECTION = "Initial health boost";

		public const int ADDITIONAL_HEALTH_UNLOCK_DEFAULT = 20;

		public const string ADDITIONAL_HEALTH_UNLOCK_DESCRIPTION = "Amount of health gained when unlocking the upgrade";

		public const string ADDITIONAL_HEALTH_INCREMENT_SECTION = "Additional health boost";

		public const int ADDITIONAL_HEALTH_INCREMENT_DEFAULT = 20;

		public const string ADDITIONAL_HEALTH_INCREMENT_DESCRIPTION = "Every time Stimpack is upgraded this value will be added to the value above.";

		private void Awake()
		{
			upgradeName = "Stimpack";
			logger = new LguLogger("Stimpack");
			Instance = this;
			changingAttribute = GameAttribute.PLAYER_HEALTH;
			initialValue = UpgradeBus.Instance.PluginConfiguration.PLAYER_HEALTH_ADDITIONAL_HEALTH_UNLOCK.Value;
			incrementalValue = UpgradeBus.Instance.PluginConfiguration.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT.Value;
		}

		public override void Increment()
		{
			base.Increment();
			PlayerControllerB val = UpgradeBus.Instance.GetLocalPlayer();
			PlayerHealthUpdateLevelServerRpc(val.playerSteamId, BaseUpgrade.GetUpgradeLevel("Stimpack"));
		}

		public override void Unwind()
		{
			base.Unwind();
			PlayerControllerB val = UpgradeBus.Instance.GetLocalPlayer();
			PlayerHealthUpdateLevelServerRpc(val.playerSteamId, -1);
		}

		public static int CheckForAdditionalHealth(int health)
		{
			if (!UpgradeBus.Instance.PluginConfiguration.PLAYER_HEALTH_ENABLED.Value)
			{
				return health;
			}
			PlayerControllerB val = UpgradeBus.Instance.GetLocalPlayer();
			if (!Instance.playerHealthLevels.ContainsKey(val.playerSteamId))
			{
				return health;
			}
			int num = Instance.playerHealthLevels[val.playerSteamId];
			return health + UpgradeBus.Instance.PluginConfiguration.PLAYER_HEALTH_ADDITIONAL_HEALTH_UNLOCK.Value + num * UpgradeBus.Instance.PluginConfiguration.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT.Value;
		}

		public static int GetHealthFromPlayer(int health, ulong steamId)
		{
			int num = Instance.playerHealthLevels[steamId];
			return health + UpgradeBus.Instance.PluginConfiguration.PLAYER_HEALTH_ADDITIONAL_HEALTH_UNLOCK.Value + num * UpgradeBus.Instance.PluginConfiguration.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT.Value;
		}

		public string GetWorldBuildingText(bool shareStatus = false)
		{
			return string.Format("\n\nAn experimental Company-offered 'health treatment' program advertised only on old, peeling Ship posters, which are them