Decompiled source of Lategame Upgrades v3.7.2

BepInEx/plugins/MoreShipUpgrades/MoreShipUpgrades.dll

Decompiled 4 days 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.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CSync.Extensions;
using CSync.Lib;
using GameNetcodeStuff;
using HarmonyLib;
using InteractiveTerminalAPI.UI;
using InteractiveTerminalAPI.UI.Application;
using InteractiveTerminalAPI.UI.Cursor;
using InteractiveTerminalAPI.UI.Page;
using InteractiveTerminalAPI.UI.Screen;
using LethalCompanyInputUtils.Api;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using MoreShipUpgrades.API;
using MoreShipUpgrades.Compat;
using MoreShipUpgrades.Input;
using MoreShipUpgrades.Managers;
using MoreShipUpgrades.Misc;
using MoreShipUpgrades.Misc.Commands;
using MoreShipUpgrades.Misc.TerminalNodes;
using MoreShipUpgrades.Misc.UI.Application;
using MoreShipUpgrades.Misc.UI.Cursor;
using MoreShipUpgrades.Misc.Upgrades;
using MoreShipUpgrades.Misc.Util;
using MoreShipUpgrades.NetcodePatcher;
using MoreShipUpgrades.Patches.Enemies;
using MoreShipUpgrades.Patches.HUD;
using MoreShipUpgrades.Patches.Interactables;
using MoreShipUpgrades.Patches.Items;
using MoreShipUpgrades.Patches.NetworkManager;
using MoreShipUpgrades.Patches.PlayerController;
using MoreShipUpgrades.Patches.RoundComponents;
using MoreShipUpgrades.Patches.TerminalComponents;
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.RadarBooster;
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.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)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.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.7.1")]
	[BepInDependency("evaisa.lethallib", "0.13.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static readonly ManualLogSource mls = Logger.CreateLogSource("More Ship Upgrades");

		public static LategameConfiguration Config;

		private void Awake()
		{
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Expected O, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Expected O, but got Unknown
			Config = new LategameConfiguration(((BaseUnityPlugin)this).Config);
			IEnumerable<Type> types;
			try
			{
				types = Assembly.GetExecutingAssembly().GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				types = ex.Types.Where((Type t) => t != null);
			}
			foreach (Type item in types)
			{
				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");
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<UpgradeBus>();
			val = new GameObject("SpawnItemManager");
			val.AddComponent<ItemManager>();
			UpgradeBus.Instance.UpgradeAssets = bundle;
			SetupModStore(ref bundle);
			SetupItems(ref types);
			SetupCommands(ref types);
			SetupPerks(ref types);
			ContractManager.SetupContractMapObjects(ref bundle);
			InputUtils_Compat.Init();
			PatchManager.PatchMainVersion();
			InteractiveTerminalManager.RegisterApplication<UpgradeStoreApplication>(new string[2] { "lgu", "lategame store" });
			InteractiveTerminalManager.RegisterApplication<WeatherProbeApplication>("probe");
			InteractiveTerminalManager.RegisterApplication<ExtendDeadlineApplication>("extend deadline");
			InteractiveTerminalManager.RegisterApplication<ContractApplication>("contracts");
			mls.LogInfo((object)"More Ship Upgrades 3.7.1 has been loaded successfully.");
		}

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

		private void SetupItems(ref IEnumerable<Type> types)
		{
			foreach (Type type in types)
			{
				if (type.IsSubclassOf(typeof(LategameItem)) && !(type == typeof(LategameItem)))
				{
					UpgradeBus.Instance.itemTypes.Add(type);
					MethodInfo method = type.GetMethod("LoadItem", BindingFlags.Static | BindingFlags.Public);
					if (!(method == null))
					{
						method.Invoke(null, null);
					}
				}
			}
			mls.LogInfo((object)"Items have been setup");
		}

		private void SetupPerks(ref IEnumerable<Type> types)
		{
			foreach (Type type in types)
			{
				if (type.IsSubclassOf(typeof(BaseUpgrade)) && !(type == typeof(OneTimeUpgrade)) && !(type == typeof(TierUpgrade)) && !(type == typeof(GameAttributeTierUpgrade)))
				{
					UpgradeBus.Instance.upgradeTypes.Add(type);
					MethodInfo method = type.GetMethod("RegisterUpgrade", BindingFlags.Static | BindingFlags.Public);
					method.Invoke(null, null);
				}
			}
			mls.LogInfo((object)"Upgrades have been setup");
		}

		private void SetupCommands(ref IEnumerable<Type> types)
		{
			foreach (Type type in types)
			{
				if (type.IsSubclassOf(typeof(BaseCommand)))
				{
					UpgradeBus.Instance.commandTypes.Add(type);
					MethodInfo method = type.GetMethod("RegisterCommand", BindingFlags.Static | BindingFlags.Public);
					method.Invoke(null, null);
				}
			}
			mls.LogInfo((object)"Commands have been setup");
		}
	}
	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 AluminiumCoils : TierUpgrade
	{
		internal const string UPGRADE_NAME = "Aluminium Coils";

		internal const string DEFAULT_PRICES = "600, 800, 1000";

		public override bool CanInitializeOnStart
		{
			get
			{
				string[] array = UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_PRICES.Value.Split(',');
				return UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_PRICE.Value <= 0 && array.Length == 1 && (array[0] == "" || array[0] == "0");
			}
		}

		internal override void Start()
		{
			upgradeName = "Aluminium Coils";
			overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_OVERRIDE_NAME);
			base.Start();
		}

		public static float ApplyDifficultyDecrease(float defaultDifficulty)
		{
			if (!BaseUpgrade.GetActiveUpgrade("Aluminium Coils"))
			{
				return defaultDifficulty;
			}
			float num = 1f - (float)(UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_INITIAL_DIFFICULTY_DECREASE.Value + BaseUpgrade.GetUpgradeLevel("Aluminium Coils") * UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_INCREMENTAL_DIFFICULTY_DECREASE.Value) / 100f;
			return Mathf.Clamp(defaultDifficulty * num, 0f, defaultDifficulty);
		}

		public static float ApplyCooldownDecrease(float defaultCooldown)
		{
			if (!BaseUpgrade.GetActiveUpgrade("Aluminium Coils"))
			{
				return defaultCooldown;
			}
			float num = 1f - (float)(UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_INITIAL_COOLDOWN_DECREASE.Value + BaseUpgrade.GetUpgradeLevel("Aluminium Coils") * UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_INCREMENTAL_COOLDOWN_DECREASE.Value) / 100f;
			return Mathf.Clamp(defaultCooldown * num, 0f, defaultCooldown);
		}

		public static float ApplyIncreasedStunTimer(float defaultStunTimer)
		{
			if (!BaseUpgrade.GetActiveUpgrade("Aluminium Coils"))
			{
				return defaultStunTimer;
			}
			float num = UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_INITIAL_STUN_TIMER_INCREASE.Value + (float)BaseUpgrade.GetUpgradeLevel("Aluminium Coils") * UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_INCREMENTAL_STUN_TIMER_INCREASE.Value;
			return defaultStunTimer + num;
		}

		public static float ApplyIncreasedStunRange(float defaultRange)
		{
			if (!BaseUpgrade.GetActiveUpgrade("Aluminium Coils"))
			{
				return defaultRange;
			}
			float num = UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_INITIAL_RANGE_INCREASE.Value + (float)BaseUpgrade.GetUpgradeLevel("Aluminium Coils") * UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_INCREMENTAL_RANGE_INCREASE.Value;
			return defaultRange + num;
		}

		private string GetAluminiumCoilsInfo(int level, int price)
		{
			Func<int, float> func = (int level) => UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_INITIAL_DIFFICULTY_DECREASE.Value + level * UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_INCREMENTAL_DIFFICULTY_DECREASE.Value;
			Func<int, float> func2 = (int level) => UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_INITIAL_RANGE_INCREASE.Value + (float)level * UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_INCREMENTAL_RANGE_INCREASE.Value;
			Func<int, float> func3 = (int level) => UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_INITIAL_STUN_TIMER_INCREASE.Value + (float)level * UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_INCREMENTAL_STUN_TIMER_INCREASE.Value;
			Func<int, float> func4 = (int level) => UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_INITIAL_COOLDOWN_DECREASE.Value + level * UpgradeBus.Instance.PluginConfiguration.ALUMINIUM_COILS_INCREMENTAL_COOLDOWN_DECREASE.Value;
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append($"LVL {level} - ${price}: Upgrades to zap gun:\n");
			stringBuilder.Append($"- Increases zap gun's range by {func2(level - 1) / 13f * 100f:F0}%\n");
			stringBuilder.Append($"- Stun time increased by {func3(level - 1)} seconds\n");
			stringBuilder.Append($"- Decreases the minigame's difficulty by {func(level - 1):F0}%\n");
			stringBuilder.Append($"- Decreases the zap gun's cooldown by {func4(level - 1):F0}%\n");
			stringBuilder.Append('\n');
			return stringBuilder.ToString();
		}

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

		public new static void RegisterUpgrade()
		{
			BaseUpgrade.SetupGenericPerk<AluminiumCoils>("Aluminium Coils");
		}

		public new static CustomTerminalNode RegisterTerminalNode()
		{
			LategameConfiguration pluginConfiguration = UpgradeBus.Instance.PluginConfiguration;
			return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Aluminium Coils", pluginConfiguration.SHARED_UPGRADES.Value || !pluginConfiguration.ALUMINIUM_COILS_INDIVIDUAL.Value, pluginConfiguration.ALUMINIUM_COILS_ENABLED.Value, pluginConfiguration.ALUMINIUM_COILS_PRICE.Value, UpgradeBus.ParseUpgradePrices(pluginConfiguration.ALUMINIUM_COILS_PRICES.Value), SyncedEntry<bool>.op_Implicit(pluginConfiguration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(pluginConfiguration.ALUMINIUM_COILS_OVERRIDE_NAME) : "");
		}

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

		protected internal override string __getTypeName()
		{
			return "AluminiumCoils";
		}
	}
	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";

		public override bool CanInitializeOnStart
		{
			get
			{
				string[] array = UpgradeBus.Instance.PluginConfiguration.BACK_MUSCLES_UPGRADE_PRICES.Value.Split(',');
				return UpgradeBus.Instance.PluginConfiguration.BACK_MUSCLES_PRICE.Value <= 0 && array.Length == 1 && (array[0] == "" || array[0] == "0");
			}
		}

		private void Awake()
		{
			upgradeName = "Back Muscles";
			overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.BACK_MUSCLES_OVERRIDE_NAME);
			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);
		}

		public new static void RegisterUpgrade()
		{
			BaseUpgrade.SetupGenericPerk<BackMuscles>("Back Muscles");
		}

		public new static CustomTerminalNode RegisterTerminalNode()
		{
			LategameConfiguration pluginConfiguration = UpgradeBus.Instance.PluginConfiguration;
			return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Back Muscles", pluginConfiguration.SHARED_UPGRADES.Value || !pluginConfiguration.BACK_MUSCLES_INDIVIDUAL.Value, pluginConfiguration.BACK_MUSCLES_ENABLED.Value, pluginConfiguration.BACK_MUSCLES_PRICE.Value, UpgradeBus.ParseUpgradePrices(pluginConfiguration.BACK_MUSCLES_UPGRADE_PRICES.Value), SyncedEntry<bool>.op_Implicit(pluginConfiguration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(pluginConfiguration.BACK_MUSCLES_OVERRIDE_NAME) : "");
		}

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

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

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

		public override bool CanInitializeOnStart
		{
			get
			{
				string[] array = UpgradeBus.Instance.PluginConfiguration.BARGAIN_CONNECTIONS_PRICES.Value.Split(',');
				return UpgradeBus.Instance.PluginConfiguration.BARGAIN_CONNECTIONS_PRICE.Value <= 0 && array.Length == 1 && (array[0] == "" || array[0] == "0");
			}
		}

		internal override void Start()
		{
			upgradeName = "Bargain Connections";
			overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.BARGAIN_CONNECTIONS_OVERRIDE_NAME);
			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);
		}

		public new static void RegisterUpgrade()
		{
			BaseUpgrade.SetupGenericPerk<BargainConnections>("Bargain Connections");
		}

		public new static CustomTerminalNode RegisterTerminalNode()
		{
			LategameConfiguration pluginConfiguration = UpgradeBus.Instance.PluginConfiguration;
			return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Bargain Connections", shareStatus: true, pluginConfiguration.BARGAIN_CONNECTIONS_ENABLED.Value, pluginConfiguration.BARGAIN_CONNECTIONS_PRICE.Value, UpgradeBus.ParseUpgradePrices(pluginConfiguration.BARGAIN_CONNECTIONS_PRICES.Value), SyncedEntry<bool>.op_Implicit(pluginConfiguration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(pluginConfiguration.BARGAIN_CONNECTIONS_OVERRIDE_NAME) : "");
		}

		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";

		public override bool CanInitializeOnStart
		{
			get
			{
				string[] array = UpgradeBus.Instance.PluginConfiguration.BEEKEEPER_UPGRADE_PRICES.Value.Split(',');
				return UpgradeBus.Instance.PluginConfiguration.BEEKEEPER_PRICE.Value <= 0 && array.Length == 1 && (array[0] == "" || array[0] == "0");
			}
		}

		private void Awake()
		{
			upgradeName = "Beekeeper";
			overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.BEEKEEPER_OVERRIDE_NAME);
			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;
				}
			}
		}

		public new static void RegisterUpgrade()
		{
			BaseUpgrade.SetupGenericPerk<Beekeeper>("Beekeeper");
		}

		public new static CustomTerminalNode RegisterTerminalNode()
		{
			LategameConfiguration pluginConfiguration = UpgradeBus.Instance.PluginConfiguration;
			return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Beekeeper", pluginConfiguration.SHARED_UPGRADES.Value || !pluginConfiguration.BEEKEEPER_INDIVIDUAL.Value, pluginConfiguration.BEEKEEPER_ENABLED.Value, pluginConfiguration.BEEKEEPER_PRICE.Value, UpgradeBus.ParseUpgradePrices(pluginConfiguration.BEEKEEPER_UPGRADE_PRICES.Value), SyncedEntry<bool>.op_Implicit(pluginConfiguration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(pluginConfiguration.BEEKEEPER_OVERRIDE_NAME) : "");
		}

		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");

		public override bool CanInitializeOnStart => UpgradeBus.Instance.PluginConfiguration.BETTER_SCANNER_PRICE.Value <= 0 && UpgradeBus.Instance.PluginConfiguration.BETTER_SCANNER_PRICE2.Value <= 0 && UpgradeBus.Instance.PluginConfiguration.BETTER_SCANNER_PRICE3.Value <= 0;

		internal override void Start()
		{
			upgradeName = "Better Scanner";
			overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.BETTER_SCANNER_OVERRIDE_NAME);
			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();
		}

		public new static void RegisterUpgrade()
		{
			BaseUpgrade.SetupGenericPerk<BetterScanner>("Better Scanner");
		}

		public new static CustomTerminalNode RegisterTerminalNode()
		{
			LategameConfiguration pluginConfiguration = UpgradeBus.Instance.PluginConfiguration;
			return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Better Scanner", pluginConfiguration.SHARED_UPGRADES.Value || !pluginConfiguration.BETTER_SCANNER_INDIVIDUAL.Value, pluginConfiguration.BETTER_SCANNER_ENABLED.Value, pluginConfiguration.BETTER_SCANNER_PRICE.Value, new int[2]
			{
				pluginConfiguration.BETTER_SCANNER_PRICE2.Value,
				pluginConfiguration.BETTER_SCANNER_PRICE3.Value
			}, SyncedEntry<bool>.op_Implicit(pluginConfiguration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(pluginConfiguration.BETTER_SCANNER_OVERRIDE_NAME) : "");
		}

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

		protected internal override string __getTypeName()
		{
			return "BetterScanner";
		}
	}
	internal class ChargingBooster : TierUpgrade, IServerSync
	{
		internal const string UPGRADE_NAME = "Charging Booster";

		internal float chargeCooldown;

		internal static ChargingBooster Instance { get; private set; }

		public override bool CanInitializeOnStart
		{
			get
			{
				string[] array = UpgradeBus.Instance.PluginConfiguration.CHARGING_BOOSTER_PRICES.Value.Split(',');
				return UpgradeBus.Instance.PluginConfiguration.CHARGING_BOOSTER_PRICE.Value <= 0 && array.Length == 1 && (array[0] == "" || array[0] == "0");
			}
		}

		private void Awake()
		{
			Instance = this;
		}

		internal override void Start()
		{
			upgradeName = "Charging Booster";
			overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.CHARGING_BOOSTER_OVERRIDE_NAME);
			chargeCooldown = UpgradeBus.Instance.PluginConfiguration.CHARGING_BOOSTER_COOLDOWN.Value;
			base.Start();
		}

		public override void Load()
		{
			base.Load();
			RadarBoosterItem[] array = Object.FindObjectsOfType<RadarBoosterItem>();
			foreach (RadarBoosterItem val in array)
			{
				if (!((Object)(object)((Component)val).GetComponent<ChargingStationManager>() != (Object)null))
				{
					((Component)val).gameObject.AddComponent<ChargingStationManager>();
				}
			}
		}

		public override void Increment()
		{
			base.Increment();
			chargeCooldown = Mathf.Clamp(chargeCooldown - UpgradeBus.Instance.PluginConfiguration.CHARGING_BOOSTER_INCREMENTAL_COOLDOWN_DECREASE.Value, 0f, UpgradeBus.Instance.PluginConfiguration.CHARGING_BOOSTER_COOLDOWN.Value);
		}

		[ServerRpc(RequireOwnership = false)]
		internal void UpdateCooldownServerRpc(NetworkBehaviourReference radarBooster)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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(3584915330u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref radarBooster, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3584915330u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					UpdateCooldownClientRpc(radarBooster);
				}
			}
		}

		[ClientRpc]
		private void UpdateCooldownClientRpc(NetworkBehaviourReference radarBooster)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3718277922u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref radarBooster, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3718277922u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			RadarBoosterItem val3 = default(RadarBoosterItem);
			((NetworkBehaviourReference)(ref radarBooster)).TryGet<RadarBoosterItem>(ref val3, (NetworkManager)null);
			if (!((Object)(object)val3 == (Object)null))
			{
				ChargingStationManager component = ((Component)val3).GetComponent<ChargingStationManager>();
				if (!((Object)(object)component == (Object)null))
				{
					component.cooldown = chargeCooldown;
				}
			}
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			Func<int, float> infoFunction = (int level) => UpgradeBus.Instance.PluginConfiguration.CHARGING_BOOSTER_COOLDOWN.Value - (float)(level + 1) * UpgradeBus.Instance.PluginConfiguration.CHARGING_BOOSTER_INCREMENTAL_COOLDOWN_DECREASE.Value;
			string infoFormat = "LVL {0} - ${1} - Radar boosters will have a recharge cooldown of {2} seconds.\n";
			return $"LVL 1 - ${initialPrice} -  Provides charging stations to the radar boosters. After used, goes on cooldown for {UpgradeBus.Instance.PluginConfiguration.CHARGING_BOOSTER_COOLDOWN.Value} seconds\n" + Tools.GenerateInfoForUpgrade(infoFormat, 0, incrementalPrices.ToArray(), infoFunction, skipFirst: true);
		}

		public new static void RegisterUpgrade()
		{
			BaseUpgrade.SetupGenericPerk<ChargingBooster>("Charging Booster");
		}

		public new static CustomTerminalNode RegisterTerminalNode()
		{
			LategameConfiguration pluginConfiguration = UpgradeBus.Instance.PluginConfiguration;
			return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Charging Booster", shareStatus: true, pluginConfiguration.CHARGING_BOOSTER_ENABLED.Value, pluginConfiguration.CHARGING_BOOSTER_PRICE.Value, UpgradeBus.ParseUpgradePrices(pluginConfiguration.CHARGING_BOOSTER_PRICES.Value), SyncedEntry<bool>.op_Implicit(pluginConfiguration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(pluginConfiguration.CHARGING_BOOSTER_OVERRIDE_NAME) : "");
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ChargingBooster()
		{
			//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(3584915330u, new RpcReceiveHandler(__rpc_handler_3584915330));
			NetworkManager.__rpc_func_table.Add(3718277922u, new RpcReceiveHandler(__rpc_handler_3718277922));
		}

		private static void __rpc_handler_3584915330(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkBehaviourReference radarBooster = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref radarBooster, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ChargingBooster)(object)target).UpdateCooldownServerRpc(radarBooster);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		protected internal override string __getTypeName()
		{
			return "ChargingBooster";
		}
	}
	internal class DeepPockets : TierUpgrade
	{
		internal const string UPGRADE_NAME = "Deeper Pockets";

		internal const string DEFAULT_PRICES = "750";

		public override bool CanInitializeOnStart
		{
			get
			{
				string[] array = UpgradeBus.Instance.PluginConfiguration.DEEPER_POCKETS_PRICES.Value.Split(',');
				return UpgradeBus.Instance.PluginConfiguration.DEEPER_POCKETS_PRICE.Value <= 0 && array.Length == 1 && (array[0] == "" || array[0] == "0");
			}
		}

		internal override void Start()
		{
			upgradeName = "Deeper Pockets";
			overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.DEEPER_POCKETS_OVERRIDE_NAME);
			base.Start();
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			Func<int, float> infoFunction = (int level) => UpgradeBus.Instance.PluginConfiguration.DEEPER_POCKETS_INITIAL_TWO_HANDED_ITEMS.Value + level * UpgradeBus.Instance.PluginConfiguration.DEEPER_POCKETS_INCREMENTAL_TWO_HANDED_ITEMS.Value;
			string infoFormat = "LVL {0} - ${1} - Increases the two handed carry capacity of the player by {2}\n";
			return Tools.GenerateInfoForUpgrade(infoFormat, initialPrice, incrementalPrices, infoFunction);
		}

		public new static void RegisterUpgrade()
		{
			BaseUpgrade.SetupGenericPerk<DeepPockets>("Deeper Pockets");
		}

		public new static CustomTerminalNode RegisterTerminalNode()
		{
			LategameConfiguration pluginConfiguration = UpgradeBus.Instance.PluginConfiguration;
			return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Deeper Pockets", SyncedEntry<bool>.op_Implicit(pluginConfiguration.SHARED_UPGRADES) || !SyncedEntry<bool>.op_Implicit(pluginConfiguration.DEEPER_POCKETS_INDIVIDUAL), SyncedEntry<bool>.op_Implicit(pluginConfiguration.DEEPER_POCKETS_ENABLED), SyncedEntry<int>.op_Implicit(pluginConfiguration.DEEPER_POCKETS_PRICE), UpgradeBus.ParseUpgradePrices(SyncedEntry<string>.op_Implicit(pluginConfiguration.DEEPER_POCKETS_PRICES)), SyncedEntry<bool>.op_Implicit(pluginConfiguration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(pluginConfiguration.DEEPER_POCKETS_OVERRIDE_NAME) : "");
		}

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

		protected internal override string __getTypeName()
		{
			return "DeepPockets";
		}
	}
	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";

		public override bool CanInitializeOnStart
		{
			get
			{
				string[] array = UpgradeBus.Instance.PluginConfiguration.DISCO_UPGRADE_PRICES.Value.Split(',');
				return UpgradeBus.Instance.PluginConfiguration.DISCOMBOBULATOR_PRICE.Value <= 0 && array.Length == 1 && (array[0] == "" || array[0] == "0");
			}
		}

		private void Awake()
		{
			upgradeName = "Discombobulator";
			overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.DISCOMBOBULATOR_OVERRIDE_NAME);
			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, -1);
					}
					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);
		}

		public new static void RegisterUpgrade()
		{
			UpgradeBus.Instance.flashNoise = AssetBundleHandler.GetAudioClip("Flashbang");
			BaseUpgrade.SetupGenericPerk<Discombobulator>("Discombobulator");
		}

		public new static CustomTerminalNode RegisterTerminalNode()
		{
			LategameConfiguration pluginConfiguration = UpgradeBus.Instance.PluginConfiguration;
			AudioClip audioClip = AssetBundleHandler.GetAudioClip("Flashbang");
			if (!Object.op_Implicit((Object)(object)audioClip))
			{
				return null;
			}
			UpgradeBus.Instance.flashNoise = audioClip;
			return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Discombobulator", pluginConfiguration.SHARED_UPGRADES.Value || !pluginConfiguration.DISCOMBOBULATOR_INDIVIDUAL.Value, pluginConfiguration.DISCOMBOBULATOR_ENABLED.Value, pluginConfiguration.DISCOMBOBULATOR_PRICE.Value, UpgradeBus.ParseUpgradePrices(pluginConfiguration.DISCO_UPGRADE_PRICES.Value), SyncedEntry<bool>.op_Implicit(pluginConfiguration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(pluginConfiguration.DISCOMBOBULATOR_OVERRIDE_NAME) : "");
		}

		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 EfficientEngines : TierUpgrade, IServerSync
	{
		internal const string UPGRADE_NAME = "Efficient Engines";

		internal const string DEFAULT_PRICES = "600, 750, 900";

		public override bool CanInitializeOnStart
		{
			get
			{
				string[] array = UpgradeBus.Instance.PluginConfiguration.EFFICIENT_ENGINES_PRICES.Value.Split(',');
				return UpgradeBus.Instance.PluginConfiguration.EFFICIENT_ENGINES_PRICE.Value <= 0 && array.Length == 1 && (array[0] == "" || array[0] == "0");
			}
		}

		private void Awake()
		{
			upgradeName = "Efficient Engines";
			overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.EFFICIENT_ENGINES_OVERRIDE_NAME);
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			Func<int, float> infoFunction = (int level) => UpgradeBus.Instance.PluginConfiguration.EFFICIENT_ENGINES_INITIAL_DISCOUNT.Value + level * UpgradeBus.Instance.PluginConfiguration.EFFICIENT_ENGINES_INCREMENTAL_DISCOUNT.Value;
			string infoFormat = "LVL {0} - ${1} - Moon routing will be {2}% cheaper\n";
			return Tools.GenerateInfoForUpgrade(infoFormat, initialPrice, incrementalPrices, infoFunction);
		}

		public static int GetDiscountedMoonPrice(int defaultPrice)
		{
			if (!UpgradeBus.Instance.PluginConfiguration.EFFICIENT_ENGINES_ENABLED.Value)
			{
				return defaultPrice;
			}
			if (!BaseUpgrade.GetActiveUpgrade("Efficient Engines"))
			{
				return defaultPrice;
			}
			if (defaultPrice == 0)
			{
				return defaultPrice;
			}
			float num = (float)defaultPrice * (1f - (float)(UpgradeBus.Instance.PluginConfiguration.EFFICIENT_ENGINES_INITIAL_DISCOUNT.Value + BaseUpgrade.GetUpgradeLevel("Efficient Engines") * UpgradeBus.Instance.PluginConfiguration.EFFICIENT_ENGINES_INCREMENTAL_DISCOUNT.Value) / 100f);
			return Mathf.CeilToInt(Mathf.Clamp(num, 0f, (float)defaultPrice));
		}

		public new static void RegisterUpgrade()
		{
			BaseUpgrade.SetupGenericPerk<EfficientEngines>("Efficient Engines");
		}

		public new static CustomTerminalNode RegisterTerminalNode()
		{
			LategameConfiguration pluginConfiguration = UpgradeBus.Instance.PluginConfiguration;
			return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Efficient Engines", shareStatus: true, pluginConfiguration.EFFICIENT_ENGINES_ENABLED.Value, pluginConfiguration.EFFICIENT_ENGINES_PRICE.Value, UpgradeBus.ParseUpgradePrices(pluginConfiguration.EFFICIENT_ENGINES_PRICES.Value), SyncedEntry<bool>.op_Implicit(pluginConfiguration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(pluginConfiguration.EFFICIENT_ENGINES_OVERRIDE_NAME) : "");
		}

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

		protected internal override string __getTypeName()
		{
			return "EfficientEngines";
		}
	}
	internal class Hunter : TierUpgrade, IUpgradeWorldBuilding
	{
		private static readonly 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 readonly 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" },
			{ "tulip snake", "Tulip Snake" },
			{ "slowersnake", "Tulip Snake" },
			{ "flower snake", "Tulip Snake" },
			{ "snake", "Tulip Snake" },
			{ "forest giant", "Forest Giant" },
			{ "forest keeper", "Forest Giant" },
			{ "forestgiant", "Forest Giant" },
			{ "forestkeeper", "Forest Giant" },
			{ "manticoil", "Manticoil" },
			{ "manti coil", "Manticoil" },
			{ "bird", "Manticoil" }
		};

		private static Dictionary<string, int> levels;

		public override bool CanInitializeOnStart
		{
			get
			{
				string[] array = UpgradeBus.Instance.PluginConfiguration.HUNTER_UPGRADE_PRICES.Value.Split(',');
				return UpgradeBus.Instance.PluginConfiguration.HUNTER_PRICE.Value <= 0 && array.Length == 1 && (array[0] == "" || array[0] == "0");
			}
		}

		public static void SetupLevels()
		{
			levels = new Dictionary<string, int>();
			string[] array = UpgradeBus.Instance.PluginConfiguration.HUNTER_SAMPLE_TIERS.Value.ToLower().Split('-');
			for (int i = 0; i < array.Length; i++)
			{
				foreach (string item in from x in array[i].Split(',')
					select x.Trim().ToLower())
				{
					if (monsterNames.TryGetValue(item, out var value))
					{
						if (levels.ContainsKey(value))
						{
							logger.LogError(value + " appears twice in samples config! Appearing now as " + item);
							continue;
						}
						logger.LogInfo($"{value} set to be harvestable at level {i + 1}");
						levels[value] = i;
					}
					else
					{
						logger.LogError("Unrecognized enemy name: " + item);
					}
				}
			}
			foreach (string key in HunterSamples.moddedLevels.Keys)
			{
				levels[key] = HunterSamples.moddedLevels[key];
				monsterNames[key.ToLower()] = key;
			}
		}

		public static bool CanHarvest(string shortName)
		{
			if (!monsterNames.TryGetValue(shortName.ToLower(), out var value))
			{
				logger.LogDebug(shortName + " is not harvestable");
				return false;
			}
			if (levels.TryGetValue(value, out var value2))
			{
				logger.LogDebug($"{value} can be harvested at level {value2 + 1}");
				return value2 <= BaseUpgrade.GetUpgradeLevel("Hunter");
			}
			logger.LogDebug(value + " cannot be harvested at any level");
			return false;
		}

		private void Awake()
		{
			upgradeName = "Hunter";
			overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.HUNTER_OVERRIDE_NAME);
			Instance = this;
		}

		public static string GetHunterInfo(int level, int price)
		{
			string arg = string.Join(", ", from item in levels
				where item.Value == level
				select item.Key);
			return string.Format(AssetBundleHandler.GetInfoFromJSON("Hunter"), level + 1, price, arg);
		}

		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)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(GetHunterInfo(0, initialPrice));
			for (int i = 0; i < maxLevels; i++)
			{
				stringBuilder.Append(GetHunterInfo(i + 1, incrementalPrices[i]));
			}
			return stringBuilder.ToString();
		}

		public new static void RegisterUpgrade()
		{
			BaseUpgrade.SetupGenericPerk<Hunter>("Hunter");
		}

		public new static CustomTerminalNode RegisterTerminalNode()
		{
			LategameConfiguration pluginConfiguration = UpgradeBus.Instance.PluginConfiguration;
			SetupLevels();
			return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Hunter", shareStatus: true, pluginConfiguration.HUNTER_ENABLED.Value, pluginConfiguration.HUNTER_PRICE.Value, UpgradeBus.ParseUpgradePrices(pluginConfiguration.HUNTER_UPGRADE_PRICES.Value), SyncedEntry<bool>.op_Implicit(pluginConfiguration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(pluginConfiguration.HUNTER_OVERRIDE_NAME) : "");
		}

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

		protected internal override string __getTypeName()
		{
			return "Hunter";
		}
	}
	internal class LandingThrusters : TierUpgrade, IServerSync
	{
		internal const string UPGRADE_NAME = "Landing Thrusters";

		internal const string DEFAULT_PRICES = "250,450,650";

		public override bool CanInitializeOnStart
		{
			get
			{
				string[] array = UpgradeBus.Instance.PluginConfiguration.LANDING_THRUSTERS_PRICES.Value.Split(',');
				return UpgradeBus.Instance.PluginConfiguration.LANDING_THRUSTERS_PRICE.Value <= 0 && array.Length == 1 && (array[0] == "" || array[0] == "0");
			}
		}

		private void Awake()
		{
			upgradeName = "Landing Thrusters";
			overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.LANDING_THRUSTERS_OVERRIDE_NAME);
		}

		public static float GetInteractMutliplier()
		{
			if (!SyncedEntry<bool>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.LANDING_THRUSTERS_ENABLED))
			{
				return 1f;
			}
			if (!SyncedEntry<bool>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.LANDING_THRUSTERS_AFFECT_LANDING))
			{
				return 1f;
			}
			if (!BaseUpgrade.GetActiveUpgrade("Landing Thrusters"))
			{
				return 1f;
			}
			return 1f + Mathf.Max(0f, (float)(SyncedEntry<int>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.LANDING_THRUSTERS_INITIAL_SPEED_INCREASE) + BaseUpgrade.GetUpgradeLevel("Landing Thrusters") * SyncedEntry<int>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.LANDING_THRUSTERS_INCREMENTAL_SPEED_INCREASE)) / 100f);
		}

		public static float GetLandingSpeedMultiplier()
		{
			if (!SyncedEntry<bool>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.LANDING_THRUSTERS_ENABLED))
			{
				return 1f;
			}
			if (!BaseUpgrade.GetActiveUpgrade("Landing Thrusters"))
			{
				return 1f;
			}
			return 1f + Mathf.Max(0f, (float)(SyncedEntry<int>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.LANDING_THRUSTERS_INITIAL_SPEED_INCREASE) + BaseUpgrade.GetUpgradeLevel("Landing Thrusters") * SyncedEntry<int>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.LANDING_THRUSTERS_INCREMENTAL_SPEED_INCREASE)) / 100f);
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			Func<int, float> infoFunction = (int level) => UpgradeBus.Instance.PluginConfiguration.LANDING_THRUSTERS_INITIAL_SPEED_INCREASE.Value + level * UpgradeBus.Instance.PluginConfiguration.LANDING_THRUSTERS_INCREMENTAL_SPEED_INCREASE.Value;
			string infoFormat = "LVL {0} - ${1} - Increases the ship's landing speed by {2}%\n";
			return Tools.GenerateInfoForUpgrade(infoFormat, initialPrice, incrementalPrices, infoFunction);
		}

		public new static void RegisterUpgrade()
		{
			BaseUpgrade.SetupGenericPerk<LandingThrusters>("Landing Thrusters");
		}

		public new static CustomTerminalNode RegisterTerminalNode()
		{
			LategameConfiguration pluginConfiguration = UpgradeBus.Instance.PluginConfiguration;
			return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Landing Thrusters", shareStatus: true, SyncedEntry<bool>.op_Implicit(pluginConfiguration.LANDING_THRUSTERS_ENABLED), SyncedEntry<int>.op_Implicit(pluginConfiguration.LANDING_THRUSTERS_PRICE), UpgradeBus.ParseUpgradePrices(SyncedEntry<string>.op_Implicit(pluginConfiguration.LANDING_THRUSTERS_PRICES)), SyncedEntry<bool>.op_Implicit(pluginConfiguration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(pluginConfiguration.LANDING_THRUSTERS_OVERRIDE_NAME) : "");
		}

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

		protected internal override string __getTypeName()
		{
			return "LandingThrusters";
		}
	}
	internal class LithiumBatteries : TierUpgrade
	{
		internal const string UPGRADE_NAME = "Lithium Batteries";

		internal const string PRICES_DEFAULT = "150, 200, 250, 300";

		public override bool CanInitializeOnStart
		{
			get
			{
				string[] array = UpgradeBus.Instance.PluginConfiguration.LITHIUM_BATTERIES_PRICES.Value.Split(',');
				return UpgradeBus.Instance.PluginConfiguration.LITHIUM_BATTERIES_PRICE.Value <= 0 && array.Length == 1 && (array[0] == "" || array[0] == "0");
			}
		}

		internal override void Start()
		{
			upgradeName = "Lithium Batteries";
			overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.LITHIUM_BATTERIES_OVERRIDE_NAME);
			base.Start();
		}

		public static float GetChargeRateMultiplier(float defaultChargeRate)
		{
			if (!BaseUpgrade.GetActiveUpgrade("Lithium Batteries"))
			{
				return defaultChargeRate;
			}
			float num = UpgradeBus.Instance.PluginConfiguration.LITHIUM_BATTERIES_INITIAL_MULTIPLIER.Value;
			num += (float)(BaseUpgrade.GetUpgradeLevel("Lithium Batteries") * UpgradeBus.Instance.PluginConfiguration.LITHIUM_BATTERIES_INCREMENTAL_MULTIPLIER.Value);
			num = (100f - num) / 100f;
			return defaultChargeRate * num;
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			Func<int, float> infoFunction = (int level) => UpgradeBus.Instance.PluginConfiguration.LITHIUM_BATTERIES_INITIAL_MULTIPLIER.Value + level * UpgradeBus.Instance.PluginConfiguration.LITHIUM_BATTERIES_INCREMENTAL_MULTIPLIER.Value;
			string infoFormat = "LVL {0} - ${1} - Decreases the rate of battery used on the items by {2}%\n";
			return Tools.GenerateInfoForUpgrade(infoFormat, initialPrice, incrementalPrices, infoFunction);
		}

		public new static void RegisterUpgrade()
		{
			BaseUpgrade.SetupGenericPerk<LithiumBatteries>("Lithium Batteries");
		}

		public new static CustomTerminalNode RegisterTerminalNode()
		{
			LategameConfiguration pluginConfiguration = UpgradeBus.Instance.PluginConfiguration;
			return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Lithium Batteries", pluginConfiguration.SHARED_UPGRADES.Value || !pluginConfiguration.LITHIUM_BATTERIES_INDIVIDUAL.Value, pluginConfiguration.LITHIUM_BATTERIES_ENABLED.Value, pluginConfiguration.LITHIUM_BATTERIES_PRICE.Value, UpgradeBus.ParseUpgradePrices(pluginConfiguration.LITHIUM_BATTERIES_PRICES.Value), SyncedEntry<bool>.op_Implicit(pluginConfiguration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(pluginConfiguration.LITHIUM_BATTERIES_OVERRIDE_NAME) : "");
		}

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

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

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

		public override bool CanInitializeOnStart
		{
			get
			{
				string[] array = UpgradeBus.Instance.PluginConfiguration.MARKET_INFLUENCE_PRICES.Value.Split(',');
				return UpgradeBus.Instance.PluginConfiguration.MARKET_INFLUENCE_PRICE.Value <= 0 && array.Length == 1 && (array[0] == "" || array[0] == "0");
			}
		}

		internal override void Start()
		{
			upgradeName = "Market Influence";
			overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.MARKET_INFLUENCE_OVERRIDE_NAME);
			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);
		}

		public new static void RegisterUpgrade()
		{
			BaseUpgrade.SetupGenericPerk<MarketInfluence>("Market Influence");
		}

		public new static CustomTerminalNode RegisterTerminalNode()
		{
			LategameConfiguration pluginConfiguration = UpgradeBus.Instance.PluginConfiguration;
			return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Market Influence", shareStatus: true, pluginConfiguration.MARKET_INFLUENCE_ENABLED.Value, pluginConfiguration.MARKET_INFLUENCE_PRICE.Value, UpgradeBus.ParseUpgradePrices(pluginConfiguration.MARKET_INFLUENCE_PRICES.Value), SyncedEntry<bool>.op_Implicit(pluginConfiguration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(pluginConfiguration.MARKET_INFLUENCE_OVERRIDE_NAME) : "");
		}

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

		protected internal override string __getTypeName()
		{
			return "MarketInfluence";
		}
	}
	internal class MechanicalArms : TierUpgrade
	{
		internal const string UPGRADE_NAME = "Mechanical Arms";

		internal const string PRICES_DEFAULT = "400,600,800";

		public override bool CanInitializeOnStart
		{
			get
			{
				string[] array = UpgradeBus.Instance.PluginConfiguration.MECHANICAL_ARMS_PRICES.Value.Split(',');
				return UpgradeBus.Instance.PluginConfiguration.MECHANICAL_ARMS_PRICE.Value <= 0 && array.Length == 1 && (array[0] == "" || array[0] == "0");
			}
		}

		internal override void Start()
		{
			upgradeName = "Mechanical Arms";
			overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.MECHANICAL_ARMS_OVERRIDE_NAME);
			base.Start();
		}

		public static float GetIncreasedGrabDistance(float defaultValue)
		{
			if (!SyncedEntry<bool>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.MECHANICAL_ARMS_ENABLED))
			{
				return defaultValue;
			}
			if (!BaseUpgrade.GetActiveUpgrade("Mechanical Arms"))
			{
				return defaultValue;
			}
			float num = SyncedEntry<float>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.MECHANICAL_ARMS_INITIAL_RANGE_INCREASE) + (float)BaseUpgrade.GetUpgradeLevel("Mechanical Arms") * SyncedEntry<float>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.MECHANICAL_ARMS_INCREMENTAL_RANGE_INCREASE);
			return Mathf.Clamp(defaultValue + num, defaultValue, float.MaxValue);
		}

		public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null)
		{
			Func<int, float> infoFunction = (int level) => UpgradeBus.Instance.PluginConfiguration.MECHANICAL_ARMS_INITIAL_RANGE_INCREASE.Value + (float)level * UpgradeBus.Instance.PluginConfiguration.MECHANICAL_ARMS_INCREMENTAL_RANGE_INCREASE.Value;
			string infoFormat = "LVL {0} - ${1} - Increases the player's interaction range by {2} units.\n";
			return Tools.GenerateInfoForUpgrade(infoFormat, initialPrice, incrementalPrices, infoFunction);
		}

		public new static void RegisterUpgrade()
		{
			BaseUpgrade.SetupGenericPerk<MechanicalArms>("Mechanical Arms");
		}

		public new static CustomTerminalNode RegisterTerminalNode()
		{
			LategameConfiguration pluginConfiguration = UpgradeBus.Instance.PluginConfiguration;
			return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Mechanical Arms", SyncedEntry<bool>.op_Implicit(pluginConfiguration.SHARED_UPGRADES) || !SyncedEntry<bool>.op_Implicit(pluginConfiguration.MECHANICAL_ARMS_INDIVIDUAL), pluginConfiguration.MECHANICAL_ARMS_ENABLED.Value, pluginConfiguration.MECHANICAL_ARMS_PRICE.Value, UpgradeBus.ParseUpgradePrices(pluginConfiguration.MECHANICAL_ARMS_PRICES.Value), SyncedEntry<bool>.op_Implicit(pluginConfiguration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(pluginConfiguration.MECHANICAL_ARMS_OVERRIDE_NAME) : "");
		}

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

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

		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; }

		public override bool CanInitializeOnStart
		{
			get
			{
				string[] array = UpgradeBus.Instance.PluginConfiguration.NIGHT_VISION_UPGRADE_PRICES.Value.Split(',');
				return UpgradeBus.Instance.PluginConfiguration.NIGHT_VISION_PRICE.Value <= 0 && array.Length == 1 && (array[0] == "" || array[0] == "0");
			}
		}

		private void Awake()
		{
			Instance = this;
			upgradeName = "NV Headset Batteries";
			overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.NIGHT_VISION_OVERRIDE_NAME);
			nightVisionPrefab = AssetBundleHandler.GetItemObject("Night Vision").spawnPrefab;
		}

		internal override void Start()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			base.Start();
			((Graphic)((Component)((Component)this).transform.GetChild(0).GetChild(0)).GetComponent<Image>()).color = Tools.ConvertValueToColor(UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_UI_BAR_COLOR.LocalValue, Color.green);
			((Graphic)((Component)((Component)this).transform.GetChild(0).GetChild(1)).GetComponent<Text>()).color = Tools.ConvertValueToColor(UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_UI_TEXT_COLOR.LocalValue, Color.white);
			((Graphic)((Component)((Component)this).transform.GetChild(0).GetChild(2)).GetComponent<Image>()).color = Tools.ConvertValueToColor(UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_UI_BAR_COLOR.LocalValue, Color.green);
			((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false);
		}

		private void LateUpdate()
		{
			//IL_021b: 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)((Component)this).transform.GetChild(0)).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)((Component)this).transform.GetChild(0)).gameObject.SetActive(false);
				}
				else
				{
					((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(true);
				}
			}
			if (client.isInsideFactory || nightVisionActive)
			{
				((Behaviour)client.nightVision).enabled = true;
			}
			else
			{
				((Behaviour)client.nightVision).enabled = false;
			}
			float num2 = nightBattery / num;
			((Component)this).transform.GetChild(0).GetChild(0).localScale = new Vector3(num2, 1f, 1f);
		}

		public void Toggle()
		{
			if (BaseUpgrade.GetActiveUpgrade("NV Headset Batteries") && !UpgradeBus.Instance.GetLocalPlayer().inTerminalMenu)
			{
				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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			nightVisColor = client.nightVision.color;
			nightVisRange = client.nightVision.range;
			nightVisIntensity = client.nightVision.intensity;
			client.nightVision.color = Tools.ConvertValueToColor(UpgradeBus.Instance.PluginConfiguration.NIGHT_VIS_COLOR.LocalValue, Color.green);
			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 " + InputActionRebindingExtensions.GetBindingDisplayString(Keybinds.NvgAction, (DisplayStringOptions)0, (string)null) + " 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();
		}

		public new static void RegisterUpgrade()
		{
			BaseUpgrade.SetupGenericPerk<NightVision>("NV Headset Batteries");
		}

		public new static CustomTerminalNode RegisterTerminalNode()
		{
			LategameConfiguration pluginConfiguration = UpgradeBus.Instance.PluginConfiguration;
			CustomTerminalNode customTerminalNode = UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("NV Headset Batteries", pluginConfiguration.SHARED_UPGRADES.Value || !pluginConfiguration.NIGHT_VISION_INDIVIDUAL.Value, pluginConfiguration.NIGHT_VISION_ENABLED.Value, 0, UpgradeBus.ParseUpgradePrices(pluginConfiguration.NIGHT_VISION_UPGRADE_PRICES.Value), SyncedEntry<bool>.op_Implicit(pluginConfiguration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(pluginConfiguration.NIGHT_VISION_OVERRIDE_NAME) : "");
			if (customTerminalNode != null)
			{
				customTerminalNode.Unlocked = true;
			}
			return customTerminalNode;
		}

		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.";

		public override bool CanInitializeOnStart
		{
			get
			{
				string[] array = UpgradeBus.Instance.PluginConfiguration.PROTEIN_UPGRADE_PRICES.Value.Split(',');
				return UpgradeBus.Instance.PluginConfiguration.PROTEIN_PRICE.Value <= 0 && array.Length == 1 && (array[0] == "" || array[0] == "0");
			}
		}

		internal override void Start()
		{
			upgradeName = "Protein Powder";
			overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.PROTEIN_POWDER_OVERRIDE_NAME);
			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()
		{
			string[] array = UpgradeBus.Instance.PluginConfiguration.PROTEIN_UPGRADE_PRICES.Value.Split(',');
			int num = array.Length;
			int upgradeLevel = BaseUpgrade.GetUpgradeLevel("Protein Powder");
			if (upgradeLevel != num && (array.Length != 1 || (!(array[0] == "") && !(array[0] == "0"))))
			{
				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 overri