Decompiled source of Lategame Upgrades v3.11.0
BepInEx/plugins/MoreShipUpgrades/MoreShipUpgrades.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
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.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CSync.Extensions; using CSync.Lib; using CustomItemBehaviourLibrary.AbstractItems; using GameNetcodeStuff; using GoodItemScan; using HarmonyLib; using InteractiveTerminalAPI.Compat; using InteractiveTerminalAPI.UI; using InteractiveTerminalAPI.UI.Application; using InteractiveTerminalAPI.UI.Cursor; using InteractiveTerminalAPI.UI.Page; using InteractiveTerminalAPI.UI.Screen; using LCVR.Player; using LethalCompanyInputUtils.Api; using LethalConstellations.PluginCore; using LethalLevelLoader; using LethalLib.Extras; using LethalLib.Modules; using Microsoft.CodeAnalysis; using MoreShipUpgrades.API; using MoreShipUpgrades.Compat; using MoreShipUpgrades.Extensions; using MoreShipUpgrades.Input; using MoreShipUpgrades.Managers; using MoreShipUpgrades.Misc; using MoreShipUpgrades.Misc.Commands; 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.Patches.Weather; using MoreShipUpgrades.UI.Application; using MoreShipUpgrades.UI.Cursor; using MoreShipUpgrades.UI.TerminalNodes; 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.OneTimeUpgrades; using MoreShipUpgrades.UpgradeComponents.OneTimeUpgrades.Enemies; using MoreShipUpgrades.UpgradeComponents.OneTimeUpgrades.Items; using MoreShipUpgrades.UpgradeComponents.OneTimeUpgrades.Player; using MoreShipUpgrades.UpgradeComponents.OneTimeUpgrades.Ship; using MoreShipUpgrades.UpgradeComponents.OneTimeUpgrades.Store; using MoreShipUpgrades.UpgradeComponents.TierUpgrades; using MoreShipUpgrades.UpgradeComponents.TierUpgrades.AttributeUpgrades; using MoreShipUpgrades.UpgradeComponents.TierUpgrades.Enemies; using MoreShipUpgrades.UpgradeComponents.TierUpgrades.Items; using MoreShipUpgrades.UpgradeComponents.TierUpgrades.Items.Jetpack; using MoreShipUpgrades.UpgradeComponents.TierUpgrades.Items.RadarBooster; using MoreShipUpgrades.UpgradeComponents.TierUpgrades.Items.Shotgun; using MoreShipUpgrades.UpgradeComponents.TierUpgrades.Items.WeedKiller; using MoreShipUpgrades.UpgradeComponents.TierUpgrades.Items.Zapgun; using MoreShipUpgrades.UpgradeComponents.TierUpgrades.Player; using MoreShipUpgrades.UpgradeComponents.TierUpgrades.Ship; using MoreShipUpgrades.UpgradeComponents.TierUpgrades.Store; using Newtonsoft.Json; using Oxygen.GameObjects; using ShipInventory.Patches; 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.11.0")] [BepInDependency("evaisa.lethallib", "0.13.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource mls; internal static readonly Dictionary<string, GameObject> networkPrefabs = new Dictionary<string, GameObject>(); private void Awake() { //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown mls = ((BaseUnityPlugin)this).Logger; LategameConfiguration lategameConfiguration = 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); foreach (MethodInfo methodInfo in methods) { 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") { hideFlags = (HideFlags)61 }; val.AddComponent<UpgradeBus>(); val = new GameObject("SpawnItemManager"); val.AddComponent<ItemManager>(); UpgradeBus.Instance.UpgradeAssets = bundle; UpgradeBus.Instance.SetConfiguration(lategameConfiguration); SetupModStore(ref bundle); SetupItems(ref types); SetupCommands(ref types); SetupPerks(ref types); ContractManager.SetupContractMapObjects(ref bundle); InputUtilsCompat.Init(); PatchManager.PatchMainVersion(); InteractiveTerminalManager.RegisterApplication<UpgradeStoreApplication>(new string[2] { "lgu", "lategame store" }, false); InteractiveTerminalManager.RegisterApplication<ContractApplication>("contracts", false); if (!SyncedEntry<bool>.op_Implicit(lategameConfiguration.CONTRACT_PROVIDE_RANDOM_ONLY)) { InteractiveTerminalManager.RegisterApplication<ContractApplication>("contract", false); } mls.LogInfo((object)"More Ship Upgrades 3.11.0 has been loaded successfully."); } private void SetupModStore(ref AssetBundle bundle) { GameObject val = AssetBundleHandler.TryLoadGameObjectAsset(ref bundle, "Assets/ShipUpgrades/LguStore.prefab"); 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 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 instructs {0} how to more safely and efficiently handle Circuit Bee Nests. Departments with a LVL {1} Certification in Circuit Bee Nest Handling earn an extra commission for every Nest they sell.\n\n"; public override bool CanInitializeOnStart { get { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); string[] array = configuration.BEEKEEPER_UPGRADE_PRICES.Value.Split(','); return configuration.BEEKEEPER_PRICE.Value <= 0 && array.Length == 1 && (array[0].Length == 0 || array[0] == "0"); } } private void Awake() { upgradeName = "Beekeeper"; overridenUpgradeName = SyncedEntry<string>.op_Implicit(BaseUpgrade.GetConfiguration().BEEKEEPER_OVERRIDE_NAME); Instance = this; } public override void Increment() { base.Increment(); if (BaseUpgrade.GetUpgradeLevel("Beekeeper") == BaseUpgrade.GetConfiguration().BEEKEEPER_UPGRADE_PRICES.Value.Split(',').Length) { ToggleIncreaseHivePriceServerRpc(); } } public static int CalculateBeeDamage(int damageNumber) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!SyncedEntry<bool>.op_Implicit(configuration.BEEKEEPER_ENABLED)) { return damageNumber; } if (!BaseUpgrade.GetActiveUpgrade("Beekeeper")) { return damageNumber; } return Mathf.Clamp((int)((float)damageNumber * (configuration.BEEKEEPER_DAMAGE_MULTIPLIER.Value - (float)BaseUpgrade.GetUpgradeLevel("Beekeeper") * configuration.BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT.Value)), 0, damageNumber); } public static int GetHiveScrapValue(int originalValue) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!configuration.BEEKEEPER_ENABLED.Value || !Instance.increaseHivePrice) { return originalValue; } return (int)((float)originalValue * configuration.BEEKEEPER_HIVE_VALUE_INCREASE.Value); } public string GetWorldBuildingText(bool shareStatus = false) { return string.Format("\n\nOn-the-job training package that instructs {0} how to more safely and efficiently handle Circuit Bee Nests. Departments with a LVL {1} Certification in Circuit Bee Nest Handling earn an extra commission for every Nest they sell.\n\n", shareStatus ? "your crew" : "you", BaseUpgrade.GetConfiguration().BEEKEEPER_UPGRADE_PRICES.Value.Split(',').Length); } public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null) { string infoFromJSON = AssetBundleHandler.GetInfoFromJSON("Beekeeper"); return Tools.GenerateInfoForUpgrade(infoFromJSON, initialPrice, incrementalPrices, infoFunction) + $"\nOn maximum level, applies a {(SyncedEntry<float>.op_Implicit(BaseUpgrade.GetConfiguration().BEEKEEPER_HIVE_VALUE_INCREASE) - 1f) * 100f:F0}% scrap value increase on beehives."; static float infoFunction(int level) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return 100f * (configuration.BEEKEEPER_DAMAGE_MULTIPLIER.Value - (float)level * configuration.BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT.Value); } } [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 (string, string[]) RegisterScrapToUpgrade() { return ("Beekeeper", BaseUpgrade.GetConfiguration().BEEKEEPER_ITEM_PROGRESSION_ITEMS.Value.Split(",")); } public new static void RegisterUpgrade() { BaseUpgrade.SetupGenericPerk<Beekeeper>("Beekeeper"); } public new static CustomTerminalNode RegisterTerminalNode() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Beekeeper", configuration.SHARED_UPGRADES.Value || !configuration.BEEKEEPER_INDIVIDUAL.Value, configuration.BEEKEEPER_ENABLED.Value, configuration.BEEKEEPER_PRICE.Value, UpgradeBus.ParseUpgradePrices(configuration.BEEKEEPER_UPGRADE_PRICES.Value), SyncedEntry<bool>.op_Implicit(configuration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(configuration.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 BiggerLungs : TierUpgrade, IUpgradeWorldBuilding { public const string UPGRADE_NAME = "Bigger Lungs"; internal const string PRICES_DEFAULT = "350,450,550"; internal const string WORLD_BUILDING_TEXT = "\n\nService package for {0}. Opting into every maintenance procedure will arrange for your suit's pipes to be cleaned and repaired, filters re-issued, and DRM removed from the integrated air conditioning system.\n\n"; public override bool CanInitializeOnStart { get { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); string[] array = configuration.BIGGER_LUNGS_UPGRADE_PRICES.Value.Split(','); return configuration.BIGGER_LUNGS_PRICE.Value <= 0 && array.Length == 1 && (array[0].Length == 0 || array[0] == "0"); } } private void Awake() { upgradeName = "Bigger Lungs"; overridenUpgradeName = SyncedEntry<string>.op_Implicit(BaseUpgrade.GetConfiguration().BIGGER_LUNGS_OVERRIDE_NAME); } public static float ApplyPossibleIncreasedStaminaRegen(float regenValue) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!configuration.BIGGER_LUNGS_ENABLED.Value) { return regenValue; } if (!BaseUpgrade.GetActiveUpgrade("Bigger Lungs") || BaseUpgrade.GetUpgradeLevel("Bigger Lungs") < configuration.BIGGER_LUNGS_STAMINA_REGEN_APPLY_LEVEL.Value - 1) { return regenValue; } return regenValue * Mathf.Clamp(configuration.BIGGER_LUNGS_STAMINA_REGEN_INCREASE.Value + SyncedEntry<float>.op_Implicit(configuration.BIGGER_LUNGS_STAMINA_REGEN_INCREMENTAL_INCREASE) * (float)Mathf.Abs(BaseUpgrade.GetUpgradeLevel("Bigger Lungs") - configuration.BIGGER_LUNGS_STAMINA_REGEN_APPLY_LEVEL.Value - 1), 0f, 10f); } public static float GetAdditionalStaminaTime(float defaultValue) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!SyncedEntry<bool>.op_Implicit(configuration.BIGGER_LUNGS_ENABLED)) { return defaultValue; } if (!BaseUpgrade.GetActiveUpgrade("Bigger Lungs")) { return defaultValue; } float num = SyncedEntry<float>.op_Implicit(configuration.SPRINT_TIME_INCREASE_UNLOCK) + (float)BaseUpgrade.GetUpgradeLevel("Bigger Lungs") * SyncedEntry<float>.op_Implicit(configuration.SPRINT_TIME_INCREMENT); return Mathf.Clamp(defaultValue + num, defaultValue, float.MaxValue); } public static float ApplyPossibleReducedJumpStaminaCost(float jumpCost) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!configuration.BIGGER_LUNGS_ENABLED.Value) { return jumpCost; } if (!BaseUpgrade.GetActiveUpgrade("Bigger Lungs") || BaseUpgrade.GetUpgradeLevel("Bigger Lungs") < configuration.BIGGER_LUNGS_JUMP_STAMINA_APPLY_LEVEL.Value - 1) { return jumpCost; } return jumpCost * Mathf.Clamp(configuration.BIGGER_LUNGS_JUMP_STAMINA_COST_DECREASE.Value - SyncedEntry<float>.op_Implicit(configuration.BIGGER_LUNGS_JUMP_STAMINA_COST_INCREMENTAL_DECREASE) * (float)Mathf.Abs(BaseUpgrade.GetUpgradeLevel("Bigger Lungs") - configuration.BIGGER_LUNGS_JUMP_STAMINA_APPLY_LEVEL.Value - 1), 0f, 10f); } public string GetWorldBuildingText(bool shareStatus = false) { return string.Format("\n\nService package for {0}. Opting into every maintenance procedure will arrange for your suit's pipes to be cleaned and repaired, filters re-issued, and DRM removed from the integrated air conditioning system.\n\n", shareStatus ? "your crew's suit oxigen delivery systems" : "your suit's oxygen delivery system"); } private string GetBiggerlungsInfo(int level, int price) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendFormat(AssetBundleHandler.GetInfoFromJSON("Bigger Lungs"), level, price, infoFunction(level - 1)); LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (level >= configuration.BIGGER_LUNGS_STAMINA_REGEN_APPLY_LEVEL.Value) { stringBuilder.Append($"Stamina regeneration is increased by {Mathf.FloorToInt(staminaRegenerationInfo(level) * 100f)}%\n"); } if (level >= configuration.BIGGER_LUNGS_JUMP_STAMINA_APPLY_LEVEL.Value) { stringBuilder.Append($"Stamina used when jumping is reduced by {Mathf.FloorToInt(costReductionInfo(level) * 100f)}%\n"); } return stringBuilder.ToString(); static float costReductionInfo(int level) { LategameConfiguration configuration2 = BaseUpgrade.GetConfiguration(); return 1f - (configuration2.BIGGER_LUNGS_JUMP_STAMINA_COST_DECREASE.Value - (float)level * configuration2.BIGGER_LUNGS_JUMP_STAMINA_COST_INCREMENTAL_DECREASE.Value); } static float infoFunction(int level) { LategameConfiguration configuration4 = BaseUpgrade.GetConfiguration(); return configuration4.SPRINT_TIME_INCREASE_UNLOCK.Value + (float)level * configuration4.SPRINT_TIME_INCREMENT.Value; } static float staminaRegenerationInfo(int level) { LategameConfiguration configuration3 = BaseUpgrade.GetConfiguration(); return configuration3.BIGGER_LUNGS_STAMINA_REGEN_INCREASE.Value + (float)level * configuration3.BIGGER_LUNGS_STAMINA_REGEN_INCREMENTAL_INCREASE.Value - 1f; } } public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(GetBiggerlungsInfo(1, initialPrice)); for (int i = 0; i < maxLevels; i++) { stringBuilder.Append(GetBiggerlungsInfo(i + 2, incrementalPrices[i])); } return stringBuilder.ToString(); } public new static (string, string[]) RegisterScrapToUpgrade() { return ("Bigger Lungs", BaseUpgrade.GetConfiguration().BIGGER_LUNGS_ITEM_PROGRESSION_ITEMS.Value.Split(",")); } public new static void RegisterUpgrade() { BaseUpgrade.SetupGenericPerk<BiggerLungs>("Bigger Lungs"); } public new static CustomTerminalNode RegisterTerminalNode() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Bigger Lungs", configuration.SHARED_UPGRADES.Value || !configuration.BIGGER_LUNGS_INDIVIDUAL.Value, configuration.BIGGER_LUNGS_ENABLED.Value, configuration.BIGGER_LUNGS_PRICE.Value, UpgradeBus.ParseUpgradePrices(configuration.BIGGER_LUNGS_UPGRADE_PRICES.Value), SyncedEntry<bool>.op_Implicit(configuration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(configuration.BIGGER_LUNGS_OVERRIDE_NAME) : ""); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "BiggerLungs"; } } internal class ClimbingGloves : TierUpgrade, IUpgradeWorldBuilding { internal const string UPGRADE_NAME = "Climbing Gloves"; internal const string DEFAULT_PRICES = "200,250,300"; internal const string WORLD_BUILDING_TEXT = "\n\nIn the 'GEAR' section of the Company Catalogue, at the bottom of the last page sandwiched between two ads, you find an entry for this product. They are Premium Synthetic Proprietary Ladder Gripping Gloves. The sales screed promises a 2% increase in your department's efficiency at outdoor traversal if you buy this.\n\n"; public override bool CanInitializeOnStart { get { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); string[] array = configuration.CLIMBING_GLOVES_PRICES.Value.Split(','); return configuration.CLIMBING_GLOVES_PRICE.Value <= 0 && array.Length == 1 && (array[0].Length == 0 || array[0] == "0"); } } public string GetWorldBuildingText(bool shareStatus = false) { return "\n\nIn the 'GEAR' section of the Company Catalogue, at the bottom of the last page sandwiched between two ads, you find an entry for this product. They are Premium Synthetic Proprietary Ladder Gripping Gloves. The sales screed promises a 2% increase in your department's efficiency at outdoor traversal if you buy this.\n\n"; } private void Awake() { upgradeName = "Climbing Gloves"; overridenUpgradeName = SyncedEntry<string>.op_Implicit(UpgradeBus.Instance.PluginConfiguration.CLIMBING_GLOVES_OVERRIDE_NAME); } public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null) { return Tools.GenerateInfoForUpgrade("LVL {0} - ${1} - Increases the speed of climbing ladders by {2} units.\n", initialPrice, incrementalPrices, infoFunction); static float infoFunction(int level) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return configuration.INITIAL_CLIMBING_SPEED_BOOST.Value + (float)level * configuration.INCREMENTAL_CLIMBING_SPEED_BOOST.Value; } } public static float GetAdditionalClimbingSpeed(float defaultValue) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!SyncedEntry<bool>.op_Implicit(configuration.CLIMBING_GLOVES_ENABLED)) { return defaultValue; } if (!BaseUpgrade.GetActiveUpgrade("Climbing Gloves")) { return defaultValue; } float num = SyncedEntry<float>.op_Implicit(configuration.INITIAL_CLIMBING_SPEED_BOOST) + (float)BaseUpgrade.GetUpgradeLevel("Climbing Gloves") * SyncedEntry<float>.op_Implicit(configuration.INCREMENTAL_CLIMBING_SPEED_BOOST); return Mathf.Clamp(defaultValue + num, defaultValue, float.MaxValue); } public new static (string, string[]) RegisterScrapToUpgrade() { return ("Climbing Gloves", BaseUpgrade.GetConfiguration().CLIMBING_GLOVES_ITEM_PROGRESSION_ITEMS.Value.Split(",")); } public new static void RegisterUpgrade() { BaseUpgrade.SetupGenericPerk<ClimbingGloves>("Climbing Gloves"); } public new static CustomTerminalNode RegisterTerminalNode() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Climbing Gloves", configuration.SHARED_UPGRADES.Value || !configuration.CLIMBING_GLOVES_INDIVIDUAL.Value, configuration.CLIMBING_GLOVES_ENABLED.Value, configuration.CLIMBING_GLOVES_PRICE.Value, UpgradeBus.ParseUpgradePrices(configuration.CLIMBING_GLOVES_PRICES.Value), SyncedEntry<bool>.op_Implicit(configuration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(configuration.CLIMBING_GLOVES_OVERRIDE_NAME) : ""); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "ClimbingGloves"; } } 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 const 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 { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); string[] array = configuration.PROTEIN_UPGRADE_PRICES.Value.Split(','); return configuration.PROTEIN_PRICE.Value <= 0 && array.Length == 1 && (array[0].Length == 0 || array[0] == "0"); } } internal override void Start() { upgradeName = "Protein Powder"; overridenUpgradeName = SyncedEntry<string>.op_Implicit(BaseUpgrade.GetConfiguration().PROTEIN_POWDER_OVERRIDE_NAME); base.Start(); } public static int GetShovelHitForce(int force) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!configuration.PROTEIN_ENABLED.Value) { return force; } if (!BaseUpgrade.GetActiveUpgrade("Protein Powder")) { return force; } int num = (TryToCritEnemy() ? 100 : (configuration.PROTEIN_UNLOCK_FORCE.Value + configuration.PROTEIN_INCREMENT.Value * BaseUpgrade.GetUpgradeLevel("Protein Powder"))); return force + num; } private static bool TryToCritEnemy() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); string[] array = configuration.PROTEIN_UPGRADE_PRICES.Value.Split(','); int num = array.Length; int upgradeLevel = BaseUpgrade.GetUpgradeLevel("Protein Powder"); if (upgradeLevel != num && (array.Length != 1 || (array[0].Length != 0 && !(array[0] == "0")))) { return false; } return Random.value < configuration.PROTEIN_CRIT_CHANCE.Value; } public string GetWorldBuildingText(bool shareStatus = false) { return "\n\nMultivitamins, creatine, and military surplus stimulants blended together and repackaged, then offered on subscription. Known to be habit-forming. The label includes a Company Surgeon General's warning about increased aggression.\n\n"; } public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null) { string infoFromJSON = AssetBundleHandler.GetInfoFromJSON("Protein Powder"); return Tools.GenerateInfoForUpgrade(infoFromJSON, initialPrice, incrementalPrices, infoFunction); static float infoFunction(int level) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return configuration.PROTEIN_UNLOCK_FORCE.Value + configuration.PROTEIN_INCREMENT.Value * level; } } public new static (string, string[]) RegisterScrapToUpgrade() { return ("Protein Powder", BaseUpgrade.GetConfiguration().PROTEIN_POWDER_ITEM_PROGRESSION_ITEMS.Value.Split(",")); } public new static void RegisterUpgrade() { BaseUpgrade.SetupGenericPerk<ProteinPowder>("Protein Powder"); } public new static CustomTerminalNode RegisterTerminalNode() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Protein Powder", configuration.SHARED_UPGRADES.Value || !configuration.PROTEIN_INDIVIDUAL.Value, configuration.PROTEIN_ENABLED.Value, configuration.PROTEIN_PRICE.Value, UpgradeBus.ParseUpgradePrices(configuration.PROTEIN_UPGRADE_PRICES.Value), SyncedEntry<bool>.op_Implicit(configuration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(configuration.PROTEIN_POWDER_OVERRIDE_NAME) : ""); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "ProteinPowder"; } } internal class EfficientEngines : TierUpgrade, IUpgradeWorldBuilding { internal const string UPGRADE_NAME = "Efficient Engines"; internal const string DEFAULT_PRICES = "600, 750, 900"; internal const string WORLD_BUILDING_TEXT = "\n\nService package for your Ship's autopiloting system that tweaks the parameters by which it routes between moons. By default, the autopiloting software is configured to only use the safest routes, but this package will authorize it to use faster but slightly more dangerous \"Liability Routes\" and certain spatial anomalies to expedite travel, conserving fuel costs.\n\n"; public override bool CanInitializeOnStart { get { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); string[] array = configuration.EFFICIENT_ENGINES_PRICES.Value.Split(','); return configuration.EFFICIENT_ENGINES_PRICE.Value <= 0 && array.Length == 1 && (array[0].Length == 0 || array[0] == "0"); } } public string GetWorldBuildingText(bool shareStatus = false) { return "\n\nService package for your Ship's autopiloting system that tweaks the parameters by which it routes between moons. By default, the autopiloting software is configured to only use the safest routes, but this package will authorize it to use faster but slightly more dangerous \"Liability Routes\" and certain spatial anomalies to expedite travel, conserving fuel costs.\n\n"; } private void Awake() { upgradeName = "Efficient Engines"; overridenUpgradeName = SyncedEntry<string>.op_Implicit(BaseUpgrade.GetConfiguration().EFFICIENT_ENGINES_OVERRIDE_NAME); } public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null) { return Tools.GenerateInfoForUpgrade("LVL {0} - ${1} - Moon routing will be {2}% cheaper\n", initialPrice, incrementalPrices, infoFunction); static float infoFunction(int level) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return configuration.EFFICIENT_ENGINES_INITIAL_DISCOUNT.Value + level * configuration.EFFICIENT_ENGINES_INCREMENTAL_DISCOUNT.Value; } } public static int GetDiscountedMoonPrice(int defaultPrice) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!configuration.EFFICIENT_ENGINES_ENABLED.Value) { return defaultPrice; } if (!BaseUpgrade.GetActiveUpgrade("Efficient Engines")) { return defaultPrice; } if (defaultPrice == 0) { return defaultPrice; } float num = (float)defaultPrice * (1f - (float)(configuration.EFFICIENT_ENGINES_INITIAL_DISCOUNT.Value + BaseUpgrade.GetUpgradeLevel("Efficient Engines") * configuration.EFFICIENT_ENGINES_INCREMENTAL_DISCOUNT.Value) / 100f); return Mathf.CeilToInt(Mathf.Clamp(num, 0f, (float)defaultPrice)); } public new static (string, string[]) RegisterScrapToUpgrade() { return ("Efficient Engines", BaseUpgrade.GetConfiguration().EFFICIENT_ENGINES_ITEM_PROGRESSION_ITEMS.Value.Split(",")); } public new static void RegisterUpgrade() { BaseUpgrade.SetupGenericPerk<EfficientEngines>("Efficient Engines"); } public new static CustomTerminalNode RegisterTerminalNode() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Efficient Engines", shareStatus: true, configuration.EFFICIENT_ENGINES_ENABLED.Value, configuration.EFFICIENT_ENGINES_PRICE.Value, UpgradeBus.ParseUpgradePrices(configuration.EFFICIENT_ENGINES_PRICES.Value), SyncedEntry<bool>.op_Implicit(configuration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(configuration.EFFICIENT_ENGINES_OVERRIDE_NAME) : ""); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "EfficientEngines"; } } internal class LandingThrusters : TierUpgrade, IUpgradeWorldBuilding { internal const string UPGRADE_NAME = "Landing Thrusters"; internal const string DEFAULT_PRICES = "250,450,650"; internal const string WORLD_BUILDING_TEXT = "\n\nOptimization procedure for your Ship's in-atmosphere thrusters that makes quicker landings possible by ordering the autopilot to commit to a longer freefall. Technically more dangerous, but it'll be fine."; public override bool CanInitializeOnStart { get { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); string[] array = configuration.LANDING_THRUSTERS_PRICES.Value.Split(','); return configuration.LANDING_THRUSTERS_PRICE.Value <= 0 && array.Length == 1 && (array[0].Length == 0 || array[0] == "0"); } } public string GetWorldBuildingText(bool shareStatus = false) { return "\n\nOptimization procedure for your Ship's in-atmosphere thrusters that makes quicker landings possible by ordering the autopilot to commit to a longer freefall. Technically more dangerous, but it'll be fine."; } private void Awake() { upgradeName = "Landing Thrusters"; overridenUpgradeName = SyncedEntry<string>.op_Implicit(BaseUpgrade.GetConfiguration().LANDING_THRUSTERS_OVERRIDE_NAME); } public static float GetInteractMutliplier() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!SyncedEntry<bool>.op_Implicit(configuration.LANDING_THRUSTERS_ENABLED)) { return 1f; } if (!SyncedEntry<bool>.op_Implicit(configuration.LANDING_THRUSTERS_AFFECT_LANDING)) { return 1f; } if (!BaseUpgrade.GetActiveUpgrade("Landing Thrusters")) { return 1f; } return 1f + Mathf.Max(0f, (float)(SyncedEntry<int>.op_Implicit(configuration.LANDING_THRUSTERS_INITIAL_SPEED_INCREASE) + BaseUpgrade.GetUpgradeLevel("Landing Thrusters") * SyncedEntry<int>.op_Implicit(configuration.LANDING_THRUSTERS_INCREMENTAL_SPEED_INCREASE)) / 100f); } public static float GetLandingSpeedMultiplier() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!SyncedEntry<bool>.op_Implicit(configuration.LANDING_THRUSTERS_ENABLED)) { return 1f; } if (!BaseUpgrade.GetActiveUpgrade("Landing Thrusters")) { return 1f; } return 1f + Mathf.Max(0f, (float)(SyncedEntry<int>.op_Implicit(configuration.LANDING_THRUSTERS_INITIAL_SPEED_INCREASE) + BaseUpgrade.GetUpgradeLevel("Landing Thrusters") * SyncedEntry<int>.op_Implicit(configuration.LANDING_THRUSTERS_INCREMENTAL_SPEED_INCREASE)) / 100f); } public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null) { return Tools.GenerateInfoForUpgrade("LVL {0} - ${1} - Increases the ship's landing speed by {2}%\n", initialPrice, incrementalPrices, infoFunction); static float infoFunction(int level) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return configuration.LANDING_THRUSTERS_INITIAL_SPEED_INCREASE.Value + level * configuration.LANDING_THRUSTERS_INCREMENTAL_SPEED_INCREASE.Value; } } public new static (string, string[]) RegisterScrapToUpgrade() { return ("Landing Thrusters", BaseUpgrade.GetConfiguration().LANDING_THRUSTERS_ITEM_PROGRESSION_ITEMS.Value.Split(",")); } public new static void RegisterUpgrade() { BaseUpgrade.SetupGenericPerk<LandingThrusters>("Landing Thrusters"); } public new static CustomTerminalNode RegisterTerminalNode() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Landing Thrusters", shareStatus: true, SyncedEntry<bool>.op_Implicit(configuration.LANDING_THRUSTERS_ENABLED), SyncedEntry<int>.op_Implicit(configuration.LANDING_THRUSTERS_PRICE), UpgradeBus.ParseUpgradePrices(SyncedEntry<string>.op_Implicit(configuration.LANDING_THRUSTERS_PRICES)), SyncedEntry<bool>.op_Implicit(configuration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(configuration.LANDING_THRUSTERS_OVERRIDE_NAME) : ""); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "LandingThrusters"; } } internal class ShutterBatteries : TierUpgrade, IUpgradeWorldBuilding { public const string UPGRADE_NAME = "Shutter Batteries"; public const string PRICES_DEFAULT = "200,300,400"; public const string ENABLED_SECTION = "Enable Shutter Batteries"; public const string ENABLED_DESCRIPTION = "Increases the amount of time the doors can remain shut"; public const string PRICE_SECTION = "Price of Shutter Batteries"; public const int PRICE_DEFAULT = 300; public const string INITIAL_SECTION = "Initial battery boost"; public const float INITIAL_DEFAULT = 5f; public const string INITIAL_DESCRIPTION = "Initial battery boost for the doors' lock on first purchase"; public const string INCREMENTAL_SECTION = "Incremental battery boost"; public const float INCREMENTAL_DEFAULT = 5f; public const string INCREMENTAL_DESCRIPTION = "Incremental battery boost for the doors' lock after purchase"; internal const string WORLD_BUILDING_TEXT = "\n\nService package of maintenance procedures for your Ship's Proprietary Emergency Lockout Door System, the two-button monitor you control the Ship's airlock from while moonside. Opting into all of the procedures will improve the uptime of the lockout function, which may improve your department's Fatality Record Over Time by up to 11%.\n\n"; public override bool CanInitializeOnStart { get { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); string[] array = configuration.DOOR_HYDRAULICS_BATTERY_PRICES.Value.Split(','); return configuration.DOOR_HYDRAULICS_BATTERY_PRICE.Value <= 0 && array.Length == 1 && (array[0].Length == 0 || array[0] == "0"); } } public string GetWorldBuildingText(bool shareStatus = false) { return "\n\nService package of maintenance procedures for your Ship's Proprietary Emergency Lockout Door System, the two-button monitor you control the Ship's airlock from while moonside. Opting into all of the procedures will improve the uptime of the lockout function, which may improve your department's Fatality Record Over Time by up to 11%.\n\n"; } private void Awake() { upgradeName = "Shutter Batteries"; overridenUpgradeName = SyncedEntry<string>.op_Implicit(BaseUpgrade.GetConfiguration().SHUTTER_BATTERIES_OVERRIDE_NAME); } public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null) { return Tools.GenerateInfoForUpgrade("LVL {0} - ${1} - Increases the door's hydraulic capacity to remain closed by {2} units\n", initialPrice, incrementalPrices, infoFunction); static float infoFunction(int level) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return configuration.DOOR_HYDRAULICS_BATTERY_INITIAL.Value + (float)level * configuration.DOOR_HYDRAULICS_BATTERY_INCREMENTAL.Value; } } public static float GetAdditionalDoorTime(float defaultValue) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!SyncedEntry<bool>.op_Implicit(configuration.DOOR_HYDRAULICS_BATTERY_ENABLED)) { return defaultValue; } if (!BaseUpgrade.GetActiveUpgrade("Shutter Batteries")) { return defaultValue; } float num = SyncedEntry<float>.op_Implicit(configuration.DOOR_HYDRAULICS_BATTERY_INITIAL) + (float)BaseUpgrade.GetUpgradeLevel("Shutter Batteries") * SyncedEntry<float>.op_Implicit(configuration.DOOR_HYDRAULICS_BATTERY_INCREMENTAL); return Mathf.Clamp(defaultValue + num, defaultValue, float.MaxValue); } public new static (string, string[]) RegisterScrapToUpgrade() { return ("Shutter Batteries", BaseUpgrade.GetConfiguration().SHUTTER_BATTERIES_ITEM_PROGRESSION_ITEMS.Value.Split(",")); } public new static void RegisterUpgrade() { BaseUpgrade.SetupGenericPerk<ShutterBatteries>("Shutter Batteries"); } public new static CustomTerminalNode RegisterTerminalNode() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Shutter Batteries", shareStatus: true, configuration.DOOR_HYDRAULICS_BATTERY_ENABLED.Value, configuration.DOOR_HYDRAULICS_BATTERY_PRICE.Value, UpgradeBus.ParseUpgradePrices(configuration.DOOR_HYDRAULICS_BATTERY_PRICES.Value), SyncedEntry<bool>.op_Implicit(configuration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(configuration.SHUTTER_BATTERIES_OVERRIDE_NAME) : ""); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "ShutterBatteries"; } } } namespace MoreShipUpgrades.UpgradeComponents.TierUpgrades.Store { internal class BargainConnections : TierUpgrade, IUpgradeWorldBuilding { internal const string UPGRADE_NAME = "Bargain Connections"; internal const string PRICES_DEFAULT = "225,300,375"; internal const string WORLD_BUILDING_TEXT = "\n\nSubscription to 'Coupon Cutters' magazine. Every once in a while the magazine comes with coupons already cut out from it. Strange.\n\n"; public override bool CanInitializeOnStart { get { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); string[] array = configuration.BARGAIN_CONNECTIONS_PRICES.Value.Split(','); return configuration.BARGAIN_CONNECTIONS_PRICE.Value <= 0 && array.Length == 1 && (array[0].Length == 0 || array[0] == "0"); } } internal override void Start() { upgradeName = "Bargain Connections"; overridenUpgradeName = SyncedEntry<string>.op_Implicit(BaseUpgrade.GetConfiguration().BARGAIN_CONNECTIONS_OVERRIDE_NAME); base.Start(); } public static int GetBargainConnectionsAdditionalItems(int defaultAmountItems) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!BaseUpgrade.GetActiveUpgrade("Bargain Connections")) { return defaultAmountItems; } return defaultAmountItems + configuration.BARGAIN_CONNECTIONS_INITIAL_ITEM_AMOUNT.Value + BaseUpgrade.GetUpgradeLevel("Bargain Connections") * configuration.BARGAIN_CONNECTIONS_INCREMENTAL_ITEM_AMOUNT.Value; } public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null) { return Tools.GenerateInfoForUpgrade("LVL {0} - ${1} - Increases the amount of items that can be on sale by {2}\n", initialPrice, incrementalPrices, infoFunction); static float infoFunction(int level) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return configuration.BARGAIN_CONNECTIONS_INITIAL_ITEM_AMOUNT.Value + level * configuration.BARGAIN_CONNECTIONS_INCREMENTAL_ITEM_AMOUNT.Value; } } public new static (string, string[]) RegisterScrapToUpgrade() { return ("Bargain Connections", BaseUpgrade.GetConfiguration().BARGAIN_CONNECTIONS_ITEM_PROGRESSION_ITEMS.Value.Split(",")); } public new static void RegisterUpgrade() { BaseUpgrade.SetupGenericPerk<BargainConnections>("Bargain Connections"); } public new static CustomTerminalNode RegisterTerminalNode() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Bargain Connections", shareStatus: true, configuration.BARGAIN_CONNECTIONS_ENABLED.Value, configuration.BARGAIN_CONNECTIONS_PRICE.Value, UpgradeBus.ParseUpgradePrices(configuration.BARGAIN_CONNECTIONS_PRICES.Value), SyncedEntry<bool>.op_Implicit(configuration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(configuration.BARGAIN_CONNECTIONS_OVERRIDE_NAME) : ""); } public string GetWorldBuildingText(bool shareStatus = false) { return "\n\nSubscription to 'Coupon Cutters' magazine. Every once in a while the magazine comes with coupons already cut out from it. Strange.\n\n"; } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "BargainConnections"; } } internal class MarketInfluence : TierUpgrade, IUpgradeWorldBuilding { internal const string UPGRADE_NAME = "Market Influence"; internal const string PRICES_DEFAULT = "200,350,500"; internal const string WORLD_BUILDING_TEXT = "\n\nBy investing scrip into the Company's subsidiaries that produce your equipment instead of buying the equipment itself, you are sometimes awarded coupons in the mail for various Company Store offerings.\n\n"; public override bool CanInitializeOnStart { get { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); string[] array = configuration.MARKET_INFLUENCE_PRICES.Value.Split(','); return configuration.MARKET_INFLUENCE_PRICE.Value <= 0 && array.Length == 1 && (array[0].Length == 0 || array[0] == "0"); } } public string GetWorldBuildingText(bool shareStatus = false) { return "\n\nBy investing scrip into the Company's subsidiaries that produce your equipment instead of buying the equipment itself, you are sometimes awarded coupons in the mail for various Company Store offerings.\n\n"; } internal override void Start() { upgradeName = "Market Influence"; overridenUpgradeName = SyncedEntry<string>.op_Implicit(BaseUpgrade.GetConfiguration().MARKET_INFLUENCE_OVERRIDE_NAME); base.Start(); } public static int GetGuaranteedPercentageSale(int defaultPercentage, int maxValue) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!SyncedEntry<bool>.op_Implicit(configuration.MARKET_INFLUENCE_ENABLED)) { return defaultPercentage; } if (!BaseUpgrade.GetActiveUpgrade("Market Influence")) { return defaultPercentage; } return Mathf.Clamp(defaultPercentage + configuration.MARKET_INFLUENCE_INITIAL_PERCENTAGE.Value + BaseUpgrade.GetUpgradeLevel("Market Influence") * configuration.MARKET_INFLUENCE_INCREMENTAL_PERCENTAGE.Value, 0, maxValue); } public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null) { return Tools.GenerateInfoForUpgrade("LVL {0} - ${1} - Guarantees the item sales' percentage to be at least {2}%\n", initialPrice, incrementalPrices, infoFunction); static float infoFunction(int level) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return configuration.MARKET_INFLUENCE_INITIAL_PERCENTAGE.Value + level * configuration.MARKET_INFLUENCE_INCREMENTAL_PERCENTAGE.Value; } } public new static (string, string[]) RegisterScrapToUpgrade() { return ("Market Influence", BaseUpgrade.GetConfiguration().MARKET_INFLUENCE_ITEM_PROGRESSION_ITEMS.Value.Split(",")); } public new static void RegisterUpgrade() { BaseUpgrade.SetupGenericPerk<MarketInfluence>("Market Influence"); } public new static CustomTerminalNode RegisterTerminalNode() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Market Influence", shareStatus: true, configuration.MARKET_INFLUENCE_ENABLED.Value, configuration.MARKET_INFLUENCE_PRICE.Value, UpgradeBus.ParseUpgradePrices(configuration.MARKET_INFLUENCE_PRICES.Value), SyncedEntry<bool>.op_Implicit(configuration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(configuration.MARKET_INFLUENCE_OVERRIDE_NAME) : ""); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "MarketInfluence"; } } } namespace MoreShipUpgrades.UpgradeComponents.TierUpgrades.Ship { internal class Discombobulator : TierUpgrade, IUpgradeWorldBuilding { internal float flashCooldown = 0f; 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 { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); string[] array = configuration.DISCO_UPGRADE_PRICES.Value.Split(','); return configuration.DISCOMBOBULATOR_PRICE.Value <= 0 && array.Length == 1 && (array[0].Length == 0 || array[0] == "0"); } } private void Awake() { upgradeName = "Discombobulator"; overridenUpgradeName = SyncedEntry<string>.op_Implicit(BaseUpgrade.GetConfiguration().DISCOMBOBULATOR_OVERRIDE_NAME); instance = this; } private void Update() { if (flashCooldown > 0f) { flashCooldown -= Time.deltaTime; } } [ServerRpc(RequireOwnership = false)] public void UseDiscombobulatorServerRpc() { //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(3612237191u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3612237191u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { UseDiscombobulatorClientRpc(); } } } [ClientRpc] internal void UseDiscombobulatorClientRpc() { //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(760292881u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 760292881u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Terminal terminal = UpgradeBus.Instance.GetTerminal(); PlayAudio(ref terminal); flashCooldown = BaseUpgrade.GetConfiguration().DISCOMBOBULATOR_COOLDOWN.Value; StunNearbyEnemies(ref terminal); } } } private void StunNearbyEnemies(ref Terminal terminal) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); Collider[] array = Physics.OverlapSphere(((Component)terminal).transform.position, configuration.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) { continue; } EnemyAI mainScript = component.mainScript; if (!IsEnemyBlacklisted(mainScript)) { if (CanDealDamage()) { int num = configuration.DISCOMBOBULATOR_INITIAL_DAMAGE.Value + configuration.DISCOMBOBULATOR_DAMAGE_INCREASE.Value * (BaseUpgrade.GetUpgradeLevel("Discombobulator") - configuration.DISCOMBOBULATOR_DAMAGE_LEVEL.Value); mainScript.HitEnemy(num, (PlayerControllerB)null, false, -1); } if (!mainScript.isEnemyDead) { mainScript.SetEnemyStunned(true, configuration.DISCOMBOBULATOR_STUN_DURATION.Value + configuration.DISCOMBOBULATOR_INCREMENT.Value * (float)BaseUpgrade.GetUpgradeLevel("Discombobulator"), (PlayerControllerB)null); } } } } private bool IsEnemyBlacklisted(EnemyAI enemy) { string enemyName = enemy.enemyType.enemyName; string[] blacklistedEnemies = BaseUpgrade.GetConfiguration().DISCOMBOBULATOR_BLACKLIST_ENEMIES.Value.Split(","); if (ContainsEnemyName(enemyName, blacklistedEnemies)) { return true; } ScanNodeProperties componentInChildren = ((Component)enemy).gameObject.GetComponentInChildren<ScanNodeProperties>(); if ((Object)(object)componentInChildren == (Object)null) { return false; } enemyName = componentInChildren.headerText; return ContainsEnemyName(enemyName, blacklistedEnemies); } private bool ContainsEnemyName(string enemyName, string[] blacklistedEnemies) { foreach (string value in blacklistedEnemies) { if (enemyName.Equals(value, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } private void PlayAudio(ref Terminal terminal) { terminal.terminalAudio.maxDistance = 100f; terminal.terminalAudio.PlayOneShot(UpgradeBus.Instance.flashNoise); ((MonoBehaviour)this).StartCoroutine(ResetRange(terminal)); } private bool CanDealDamage() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return configuration.DISCOMBOBULATOR_DAMAGE_LEVEL.Value > 0 && BaseUpgrade.GetUpgradeLevel("Discombobulator") + 1 >= configuration.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) { string infoFromJSON = AssetBundleHandler.GetInfoFromJSON("Discombobulator"); return Tools.GenerateInfoForUpgrade(infoFromJSON, initialPrice, incrementalPrices, infoFunction); static float infoFunction(int level) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return configuration.DISCOMBOBULATOR_STUN_DURATION.Value + (float)level * configuration.DISCOMBOBULATOR_INCREMENT.Value; } } [ServerRpc(RequireOwnership = false)] public void SetCooldownServerRpc(float cooldown) { //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) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1424881251u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref cooldown, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1424881251u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SetCooldownClientRpc(cooldown); } } } [ClientRpc] public void SetCooldownClientRpc(float cooldown) { //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) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(550063720u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref cooldown, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 550063720u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { flashCooldown = Mathf.Clamp(cooldown, 0f, SyncedEntry<float>.op_Implicit(BaseUpgrade.GetConfiguration().DISCOMBOBULATOR_COOLDOWN)); } } } public new static (string, string[]) RegisterScrapToUpgrade() { return ("Discombobulator", BaseUpgrade.GetConfiguration().DISCOMBOBULATOR_ITEM_PROGRESSION_ITEMS.Value.Split(",")); } public new static void RegisterUpgrade() { UpgradeBus.Instance.flashNoise = AssetBundleHandler.GetAudioClip("Flashbang"); BaseUpgrade.SetupGenericPerk<Discombobulator>("Discombobulator"); } public new static CustomTerminalNode RegisterTerminalNode() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); AudioClip audioClip = AssetBundleHandler.GetAudioClip("Flashbang"); if (!Object.op_Implicit((Object)(object)audioClip)) { return null; } UpgradeBus.Instance.flashNoise = audioClip; return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Discombobulator", configuration.SHARED_UPGRADES.Value || !configuration.DISCOMBOBULATOR_INDIVIDUAL.Value, configuration.DISCOMBOBULATOR_ENABLED.Value, configuration.DISCOMBOBULATOR_PRICE.Value, UpgradeBus.ParseUpgradePrices(configuration.DISCO_UPGRADE_PRICES.Value), SyncedEntry<bool>.op_Implicit(configuration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(configuration.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 //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3612237191u, new RpcReceiveHandler(__rpc_handler_3612237191)); NetworkManager.__rpc_func_table.Add(760292881u, new RpcReceiveHandler(__rpc_handler_760292881)); NetworkManager.__rpc_func_table.Add(1424881251u, new RpcReceiveHandler(__rpc_handler_1424881251)); NetworkManager.__rpc_func_table.Add(550063720u, new RpcReceiveHandler(__rpc_handler_550063720)); } private static void __rpc_handler_3612237191(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).UseDiscombobulatorServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_760292881(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).UseDiscombobulatorClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1424881251(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float cooldownServerRpc = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref cooldownServerRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((Discombobulator)(object)target).SetCooldownServerRpc(cooldownServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_550063720(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float cooldownClientRpc = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref cooldownClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((Discombobulator)(object)target).SetCooldownClientRpc(cooldownClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "Discombobulator"; } } internal class FusionMatter : TierUpgrade, IUpgradeWorldBuilding { internal const string UPGRADE_NAME = "Fusion Matter"; internal const string DEFAULT_PRICES = "650, 700"; internal const string WORLD_BUILDING_TEXT = "\n\nBy default, the Ship's onboard Teleporter system is configured not to bring any objects along with it... but isn't it kind of strange how you don't arrive naked anytime you use the Teleporter? As it turns out, this limitation is imposed and not inherent. By requesting & signing a handful of certain liability waivers by their technical names and paying forward a series of fees, you can expand the capabilities of your Ship's Teleporter. The Teleporter can still only safely transport Company-issued equipment, since the rough dimensions of these objects are well-documented. The same cannot be said for salvage materials.\n\n"; private static Dictionary<string, int> levels; public override bool CanInitializeOnStart { get { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); string[] array = configuration.FUSION_MATTER_PRICES.Value.Split(','); return configuration.FUSION_MATTER_PRICE.Value <= 0 && array.Length == 1 && (array[0].Length == 0 || array[0] == "0"); } } public string GetWorldBuildingText(bool shareStatus = false) { return "\n\nBy default, the Ship's onboard Teleporter system is configured not to bring any objects along with it... but isn't it kind of strange how you don't arrive naked anytime you use the Teleporter? As it turns out, this limitation is imposed and not inherent. By requesting & signing a handful of certain liability waivers by their technical names and paying forward a series of fees, you can expand the capabilities of your Ship's Teleporter. The Teleporter can still only safely transport Company-issued equipment, since the rough dimensions of these objects are well-documented. The same cannot be said for salvage materials.\n\n"; } internal static void SetupLevels() { levels = new Dictionary<string, int>(); string[] array = BaseUpgrade.GetConfiguration().FUSION_MATTER_ITEM_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 (levels.ContainsKey(item)) { Plugin.mls.LogWarning((object)(item + " is already registered in the tiers collection of Fusion Matter")); continue; } Plugin.mls.LogInfo((object)string.Format("Registering {0} item under level {1} of {2}", item, i, "Fusion Matter")); levels[item] = i; } } } public static bool CanHoldItem(GrabbableObject grabbableObject, PlayerControllerB player) { if ((Object)(object)grabbableObject == (Object)null || !player.IsTeleporting() || player.isPlayerDead) { return false; } string text = grabbableObject.itemProperties.itemName.Trim().ToLower(); if (levels.TryGetValue(text, out var value)) { Plugin.mls.LogDebug((object)$"{text} can be safeguarded by Fusion Matter at level {value + 1}"); return BaseUpgrade.GetUpgradeLevel("Fusion Matter") >= value; } Plugin.mls.LogDebug((object)(text + " from item properties was not found, checking other sources...")); ScanNodeProperties componentInChildren = ((Component)grabbableObject).GetComponentInChildren<ScanNodeProperties>(); if ((Object)(object)componentInChildren == (Object)null) { Plugin.mls.LogDebug((object)(text + " does not contain a scan node, ran out of sources...")); return false; } text = componentInChildren.headerText.Trim().ToLower(); if (levels.TryGetValue(text, out value)) { Plugin.mls.LogDebug((object)$"{text} can be safeguarded by Fusion Matter at level {value + 1}"); return BaseUpgrade.GetUpgradeLevel("Fusion Matter") >= value; } Plugin.mls.LogDebug((object)(text + " from scan node was not found, ran out of sources...")); return false; } private void Awake() { upgradeName = "Fusion Matter"; overridenUpgradeName = SyncedEntry<string>.op_Implicit(BaseUpgrade.GetConfiguration().FUSION_MATTER_OVERRIDE_NAME); } public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(GetFusionMatterInfo(0, initialPrice)); for (int i = 0; i < maxLevels; i++) { stringBuilder.Append(GetFusionMatterInfo(i + 1, incrementalPrices[i])); } return stringBuilder.ToString(); } public static string GetFusionMatterInfo(int level, int price) { string arg = string.Join(", ", from item in levels where item.Value == level select item.Key); return $"LVL {level + 1} - ${price} - Allows safekeeping the following items when teleporting: {arg}\n"; } public new static (string, string[]) RegisterScrapToUpgrade() { return ("Fusion Matter", BaseUpgrade.GetConfiguration().FUSION_MATTER_ITEM_PROGRESSION_ITEMS.Value.Split(",")); } public new static void RegisterUpgrade() { GameObject val = NetworkPrefabs.CreateNetworkPrefab("Fusion Matter"); val.AddComponent<FusionMatter>(); NetworkPrefabs.RegisterNetworkPrefab(val); Plugin.networkPrefabs["Fusion Matter"] = val; } public new static CustomTerminalNode RegisterTerminalNode() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); SetupLevels(); return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Fusion Matter", shareStatus: true, SyncedEntry<bool>.op_Implicit(configuration.FUSION_MATTER_ENABLED), SyncedEntry<int>.op_Implicit(configuration.FUSION_MATTER_PRICE), UpgradeBus.ParseUpgradePrices(SyncedEntry<string>.op_Implicit(configuration.FUSION_MATTER_PRICES)), SyncedEntry<bool>.op_Implicit(configuration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(configuration.FUSION_MATTER_OVERRIDE_NAME) : "", Plugin.networkPrefabs["Fusion Matter"]); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "FusionMatter"; } } public class LifeInsurance : TierUpgrade, IUpgradeWorldBuilding { internal const string UPGRADE_NAME = "Life Insurance"; internal const string DEFAULT_PRICES = "200,250,300"; internal const string WORLD_BUILDING_TEXT = "\n\nHigh-grossing departments that operate in sectors of severe risk can optimize body retrieval costs by essentially hiring the cleanup crew on a retainer. These arrangements are made Ship-to-Ship between individual Company Departments and require a lot of phonecalls and paperwork.\n\n"; public override bool CanInitializeOnStart { get { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); string[] array = configuration.LIFE_INSURANCE_PRICES.Value.Split(','); return configuration.LIFE_INSURANCE_PRICE.Value <= 0 && array.Length == 1 && (array[0].Length == 0 || array[0] == "0"); } } public string GetWorldBuildingText(bool shareStatus = false) { return "\n\nHigh-grossing departments that operate in sectors of severe risk can optimize body retrieval costs by essentially hiring the cleanup crew on a retainer. These arrangements are made Ship-to-Ship between individual Company Departments and require a lot of phonecalls and paperwork.\n\n"; } private void Awake() { upgradeName = "Life Insurance"; overridenUpgradeName = SyncedEntry<string>.op_Implicit(BaseUpgrade.GetConfiguration().LIFE_INSURANCE_OVERRIDE_NAME); } public static float CalculateDecreaseMultiplier() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!SyncedEntry<bool>.op_Implicit(configuration.LIFE_INSURANCE_ENABLED) || !BaseUpgrade.GetActiveUpgrade("Life Insurance")) { return 0f; } return (float)(SyncedEntry<int>.op_Implicit(configuration.LIFE_INSURANCE_INITIAL_COST_PERCENTAGE_DECREASE) + SyncedEntry<int>.op_Implicit(configuration.LIFE_INSURANCE_INCREMENTAL_COST_PERCENTAGE_DECREASE) * BaseUpgrade.GetUpgradeLevel("Life Insurance")) / 100f; } public static float ReduceCreditCostPercentage(float defaultValue) { float num = CalculateDecreaseMultiplier(); return Mathf.Clamp(1f - num, 0f, 1f) * defaultValue; } public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null) { return Tools.GenerateInfoForUpgrade("LVL {0} - ${1} - Reduces the credit loss when leaving a body behind when exiting a moon by {2}%\n", initialPrice, incrementalPrices, infoFunction); static float infoFunction(int level) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return configuration.LIFE_INSURANCE_INITIAL_COST_PERCENTAGE_DECREASE.Value + level * configuration.LIFE_INSURANCE_INCREMENTAL_COST_PERCENTAGE_DECREASE.Value; } } public new static (string, string[]) RegisterScrapToUpgrade() { return ("Life Insurance", BaseUpgrade.GetConfiguration().LIFE_INSURANCE_ITEM_PROGRESSION_ITEMS.Value.Split(",")); } public new static void RegisterUpgrade() { GameObject val = NetworkPrefabs.CreateNetworkPrefab("Life Insurance"); val.AddComponent<LifeInsurance>(); NetworkPrefabs.RegisterNetworkPrefab(val); Plugin.networkPrefabs["Life Insurance"] = val; } public new static CustomTerminalNode RegisterTerminalNode() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Life Insurance", shareStatus: true, SyncedEntry<bool>.op_Implicit(configuration.LIFE_INSURANCE_ENABLED), SyncedEntry<int>.op_Implicit(configuration.LIFE_INSURANCE_PRICE), UpgradeBus.ParseUpgradePrices(SyncedEntry<string>.op_Implicit(configuration.LIFE_INSURANCE_PRICES)), SyncedEntry<bool>.op_Implicit(configuration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(configuration.LIFE_INSURANCE_OVERRIDE_NAME) : "", Plugin.networkPrefabs["Life Insurance"]); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "LifeInsurance"; } } internal class MidasTouch : TierUpgrade, IUpgradeWorldBuilding { internal const string UPGRADE_NAME = "Midas Touch"; internal const string DEFAULT_PRICES = "1000,1500,1800,2000"; internal const string WORLD_BUILDING_TEXT = "\n\nYour commitment to Company Standards & Values 3E-60-92-43 and adherence to Work Code & Ethics 429-A-71-36 has appeased The Company a little bit. The memories attached to objects handled by your department are among The Company's favorites to review.\n\n"; public override bool CanInitializeOnStart { get { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); string[] array = configuration.MIDAS_TOUCH_PRICES.Value.Split(','); return configuration.MIDAS_TOUCH_PRICE.Value <= 0 && array.Length == 1 && (array[0].Length == 0 || array[0] == "0"); } } public string GetWorldBuildingText(bool shareStatus = false) { return "\n\nYour commitment to Company Standards & Values 3E-60-92-43 and adherence to Work Code & Ethics 429-A-71-36 has appeased The Company a little bit. The memories attached to objects handled by your department are among The Company's favorites to review.\n\n"; } private void Awake() { upgradeName = "Midas Touch"; overridenUpgradeName = SyncedEntry<string>.op_Implicit(BaseUpgrade.GetConfiguration().MIDAS_TOUCH_OVERRIDE_NAME); } private static float GetIncreasedScrapValueMultiplier() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return (float)(SyncedEntry<int>.op_Implicit(configuration.MIDAS_TOUCH_INITIAL_SCRAP_VALUE_INCREASE) + BaseUpgrade.GetUpgradeLevel("Midas Touch") * SyncedEntry<int>.op_Implicit(configuration.MIDAS_TOUCH_INCREMENTAL_SCRAP_VALUE_INCREASE)) / 100f; } public static float IncreaseScrapValue(float defaultValue) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!SyncedEntry<bool>.op_Implicit(configuration.MIDAS_TOUCH_ENABLED)) { return defaultValue; } if (!BaseUpgrade.GetActiveUpgrade("Midas Touch")) { return defaultValue; } float increasedScrapValueMultiplier = GetIncreasedScrapValueMultiplier(); return Mathf.Clamp(defaultValue + defaultValue * increasedScrapValueMultiplier, defaultValue, float.MaxValue); } public static int IncreaseScrapValueInteger(int defaultValue) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!SyncedEntry<bool>.op_Implicit(configuration.MIDAS_TOUCH_ENABLED)) { return defaultValue; } if (!BaseUpgrade.GetActiveUpgrade("Midas Touch")) { return defaultValue; } float num = 1f + GetIncreasedScrapValueMultiplier(); return Mathf.Clamp(Mathf.CeilToInt((float)defaultValue * num), defaultValue, int.MaxValue); } public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null) { return Tools.GenerateInfoForUpgrade("LVL {0} - ${1} - Increases the value of the scrap found in the moons by {2}%.\n", initialPrice, incrementalPrices, infoFunction); static float infoFunction(int level) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return configuration.MIDAS_TOUCH_INITIAL_SCRAP_VALUE_INCREASE.Value + level * configuration.MIDAS_TOUCH_INCREMENTAL_SCRAP_VALUE_INCREASE.Value; } } public new static (string, string[]) RegisterScrapToUpgrade() { return ("Midas Touch", BaseUpgrade.GetConfiguration().MIDAS_TOUCH_ITEM_PROGRESSION_ITEMS.Value.Split(",")); } public new static void RegisterUpgrade() { GameObject val = NetworkPrefabs.CreateNetworkPrefab("Midas Touch"); val.AddComponent<MidasTouch>(); NetworkPrefabs.RegisterNetworkPrefab(val); Plugin.networkPrefabs["Midas Touch"] = val; } public new static CustomTerminalNode RegisterTerminalNode() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Midas Touch", shareStatus: true, SyncedEntry<bool>.op_Implicit(configuration.MIDAS_TOUCH_ENABLED), SyncedEntry<int>.op_Implicit(configuration.MIDAS_TOUCH_PRICE), UpgradeBus.ParseUpgradePrices(SyncedEntry<string>.op_Implicit(configuration.MIDAS_TOUCH_PRICES)), SyncedEntry<bool>.op_Implicit(configuration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(configuration.MIDAS_TOUCH_OVERRIDE_NAME) : "", Plugin.networkPrefabs["Midas Touch"]); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "MidasTouch"; } } internal class ParticleInfuser : TierUpgrade, IUpgradeWorldBuilding { internal const string UPGRADE_NAME = "Particle Infuser"; internal const string DEFAULT_PRICES = "400,600"; internal static ParticleInfuser instance; internal const string WORLD_BUILDING_TEXT = "\n\nThe original spooling process of the Ship's onboard Teleporter is overly long for legal reasons. There are several redundant safety checks that must be completed by the Ship's computer before the Teleporter system can fire. Under duress, it's actually more important that the Teleporter operates quickly than safely. Health complications will kill your coworker in a matter of months or years, but the facility will kill them in a matter of minutes or even seconds. Any amount of timesaving matters.\n\n"; public override bool CanInitializeOnStart { get { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); string[] array = configuration.PARTICLE_INFUSER_PRICES.Value.Split(','); return configuration.PARTICLE_INFUSER_PRICE.Value <= 0 && array.Length == 1 && (array[0].Length == 0 || array[0] == "0"); } } public string GetWorldBuildingText(bool shareStatus = false) { return "\n\nThe original spooling process of the Ship's onboard Teleporter is overly long for legal reasons. There are several redundant safety checks that must be completed by the Ship's computer before the Teleporter system can fire. Under duress, it's actually more important that the Teleporter operates quickly than safely. Health complications will kill your coworker in a matter of months or years, but the facility will kill them in a matter of minutes or even seconds. Any amount of timesaving matters.\n\n"; } private void Awake() { upgradeName = "Particle Infuser"; overridenUpgradeName = SyncedEntry<string>.op_Implicit(BaseUpgrade.GetConfiguration().PARTICLE_INFUSER_OVERRIDE_NAME); instance = this; } public static float GetIncreasedTeleportSpeedMultiplier() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return (float)(SyncedEntry<int>.op_Implicit(configuration.PARTICLE_INFUSER_INITIAL_TELEPORT_SPEED_INCREASE) + BaseUpgrade.GetUpgradeLevel("Particle Infuser") * SyncedEntry<int>.op_Implicit(configuration.PARTICLE_INFUSER_INCREMENTAL_TELEPORT_SPEED_INCREASE)) / 100f; } public static float DecreaseTeleportTime(float defaultValue) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!SyncedEntry<bool>.op_Implicit(configuration.PARTICLE_INFUSER_ENABLED)) { return defaultValue; } if (!BaseUpgrade.GetActiveUpgrade("Particle Infuser")) { return defaultValue; } float increasedTeleportSpeedMultiplier = GetIncreasedTeleportSpeedMultiplier(); return Mathf.Clamp(defaultValue - defaultValue * increasedTeleportSpeedMultiplier, 0f, defaultValue); } public static float IncreaseTeleportSpeed() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!SyncedEntry<bool>.op_Implicit(configuration.PARTICLE_INFUSER_ENABLED)) { return 1f; } if (!BaseUpgrade.GetActiveUpgrade("Particle Infuser")) { return 1f; } float increasedTeleportSpeedMultiplier = GetIncreasedTeleportSpeedMultiplier(); return Mathf.Clamp(3f + increasedTeleportSpeedMultiplier, 1f, float.MaxValue); } public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null) { return Tools.GenerateInfoForUpgrade("LVL {0} - ${1} - Increases the teleporter's speed by {2}%\n", initialPrice, incrementalPrices, infoFunction); static float infoFunction(int level) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return configuration.PARTICLE_INFUSER_INITIAL_TELEPORT_SPEED_INCREASE.Value + level * configuration.PARTICLE_INFUSER_INCREMENTAL_TELEPORT_SPEED_INCREASE.Value; } } public new static (string, string[]) RegisterScrapToUpgrade() { return ("Particle Infuser", BaseUpgrade.GetConfiguration().PARTICLE_INFUSER_ITEM_PROGRESSION_ITEMS.Value.Split(",")); } public new static void RegisterUpgrade() { GameObject val = NetworkPrefabs.CreateNetworkPrefab("Particle Infuser"); val.AddComponent<ParticleInfuser>(); NetworkPrefabs.RegisterNetworkPrefab(val); Plugin.networkPrefabs["Particle Infuser"] = val; } public new static CustomTerminalNode RegisterTerminalNode() { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return UpgradeBus.Instance.SetupMultiplePurchasableTerminalNode("Particle Infuser", shareStatus: true, SyncedEntry<bool>.op_Implicit(configuration.PARTICLE_INFUSER_ENABLED), SyncedEntry<int>.op_Implicit(configuration.PARTICLE_INFUSER_PRICE), UpgradeBus.ParseUpgradePrices(SyncedEntry<string>.op_Implicit(configuration.PARTICLE_INFUSER_PRICES)), SyncedEntry<bool>.op_Implicit(configuration.OVERRIDE_UPGRADE_NAMES) ? SyncedEntry<string>.op_Implicit(configuration.PARTICLE_INFUSER_OVERRIDE_NAME) : "", Plugin.networkPrefabs["Particle Infuser"]); } public IEnumerator ResetTeleporterSpeed(ShipTeleporter teleporter) { yield return (object)new WaitForEndOfFrame(); yield return (object)new WaitWhile((Func<bool>)delegate { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) AnimatorStateInfo currentAnimatorStateInfo = teleporter.teleporterAnimator.GetCurrentAnimatorStateInfo(0); return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime < 1f; }); Animator teleporterAnimator = teleporter.teleporterAnimator; teleporterAnimator.speed /= IncreaseTeleportSpeed(); AudioSource shipTeleporterAudio = teleporter.shipTeleporterAudio; shipTeleporterAudio.pitch /= IncreaseTeleportSpeed(); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "ParticleInfuser"; } } public class QuantumDisruptor : TierUpgrade, IUpgradeWorldBuilding { public enum UpgradeModes { SlowdownTime, RevertTime } public enum ResetModes { MoonLanding, MoonRerouting, NewQuota } internal const string UPGRADE_NAME = "Quantum Disruptor"; internal const string PRICES_DEFAULT = "1200,1500,1800"; internal const string WORLD_BUILDING_TEXT = "\n\nSigning the Overtime Risk Waiver and paying forward a series of fees authorizes your department to override the Ship's autopilot system and stay moonside for longer.\n\n"; internal int availableUsages = -1; internal int currentUsages = 0; internal int hoursToReduce = -1; internal static QuantumDisruptor Instance { get; set; } internal static UpgradeModes CurrentMode => SyncedEntry<UpgradeModes>.op_Implicit(BaseUpgrade.GetConfiguration().QUANTUM_DISRUPTOR_UPGRADE_MODE); internal static ResetModes CurrentResetMode => BaseUpgrade.GetConfiguration().QUANTUM_DISRUPTOR_RESET_MODE.Value; public override bool CanInitializeOnStart { get { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); string[] array = configuration.QUANTUM_DISRUPTOR_PRICES.Value.Split(','); return configuration.QUANTUM_DISRUPTOR_PRICE.Value <= 0 && array.Length == 1 && (array[0].Length == 0 || array[0] == "0"); } } private static void SetInstance(QuantumDisruptor instance) { Instance = instance; } public string GetWorldBuildingText(bool shareStatus = false) { return "\n\nSigning the Overtime Risk Waiver and paying forward a series of fees authorizes your department to override the Ship's autopilot system and stay moonside for longer.\n\n"; } private void Awake() { SetInstance(this); upgradeName = "Quantum Disruptor"; overridenUpgradeName = SyncedEntry<string>.op_Implicit(BaseUpgrade.GetConfiguration().QUANTUM_DISRUPTOR_OVERRIDE_NAME); } public override void Unwind() { switch (CurrentMode) { case UpgradeModes.SlowdownTime: base.Unwind(); break; case UpgradeModes.RevertTime: availableUsages = -1; hoursToReduce = -1; base.Unwind(); break; } } public override void Increment() { switch (CurrentMode) { case UpgradeModes.SlowdownTime: base.Increment(); break; case UpgradeModes.RevertTime: { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); availableUsages += SyncedEntry<int>.op_Implicit(configuration.QUANTUM_DISRUPTOR_INCREMENTAL_USES); hoursToReduce += SyncedEntry<int>.op_Implicit(configuration.QUANTUM_DISRUPTOR_INCREMENTAL_HOURS_REVERT_ON_USE); base.Increment(); break; } } } public override void Load() { switch (CurrentMode) { case UpgradeModes.SlowdownTime: base.Load(); break; case UpgradeModes.RevertTime: { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); availableUsages = configuration.QUANTUM_DISRUPTOR_INITIAL_USES.Value + BaseUpgrade.GetUpgradeLevel("Quantum Disruptor") * SyncedEntry<int>.op_Implicit(configuration.QUANTUM_DISRUPTOR_INCREMENTAL_USES); hoursToReduce = configuration.QUANTUM_DISRUPTOR_INITIAL_HOURS_REVERT_ON_USE.Value + BaseUpgrade.GetUpgradeLevel("Quantum Disruptor") * SyncedEntry<int>.op_Implicit(configuration.QUANTUM_DISRUPTOR_INCREMENTAL_HOURS_REVERT_ON_USE); base.Load(); break; } } } public static float GetGlobalSpeedMultiplier(float defaultValue) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (!SyncedEntry<bool>.op_Implicit(configuration.QUANTUM_DISRUPTOR_ENABLED)) { return defaultValue; } if (!BaseUpgrade.GetActiveUpgrade("Quantum Disruptor")) { return defaultValue; } if (CurrentMode != 0) { return defaultValue; } float num = (float)(SyncedEntry<int>.op_Implicit(configuration.QUANTUM_DISRUPTOR_INITIAL_MULTIPLIER) + BaseUpgrade.GetUpgradeLevel("Quantum Disruptor") * SyncedEntry<int>.op_Implicit(configuration.QUANTUM_DISRUPTOR_INCREMENTAL_MULTIPLIER)) / 100f; return Mathf.Clamp(defaultValue - defaultValue * num, 0.01f, defaultValue); } private string GetQuantumDisruptorRevertInfo(int level, int price) { string text = string.Empty; switch (CurrentResetMode) { case ResetModes.MoonLanding: text = "moon landing"; break; case ResetModes.MoonRerouting: text = "moon routing"; break; case ResetModes.NewQuota: text = "completed quota"; break; } StringBuilder stringBuilder = new StringBuilder(); if (level == 1) { stringBuilder.Append($"LVL {level} - ${price}: Unlocks 'quantum' command which reverts curret moon's time by {infoFunctionHours(level - 1)} hours and can only be used {infoFunctionUsages(level - 1)} times per {text}\n"); } else { stringBuilder.Append($"LVL {level} - ${price}: Reverts curret moon's time by {infoFunctionHours(level - 1)} hours and can only be used {infoFunctionUsages(level - 1)} times per {text}\n"); } return stringBuilder.ToString(); static float infoFunctionHours(int level) { LategameConfiguration configuration2 = BaseUpgrade.GetConfiguration(); return configuration2.QUANTUM_DISRUPTOR_INITIAL_HOURS_REVERT_ON_USE.Value + level * configuration2.QUANTUM_DISRUPTOR_INCREMENTAL_HOURS_REVERT_ON_USE.Value; } static float infoFunctionUsages(int level) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return configuration.QUANTUM_DISRUPTOR_INITIAL_USES.Value + level * configuration.QUANTUM_DISRUPTOR_INCREMENTAL_USES.Value; } } public override string GetDisplayInfo(int initialPrice = -1, int maxLevels = -1, int[] incrementalPrices = null) { switch (CurrentMode) { case UpgradeModes.SlowdownTime: return Tools.GenerateInfoForUpgrade("LVL {0} - ${1} - Decreases the landed moon's rotation force (time passing) by {2}%\n", initialPrice, incrementalPrices, infoFunction); case UpgradeModes.RevertTime: { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(GetQuantumDisruptorRevertInfo(1, initialPrice)); for (int i = 0; i < maxLevels; i++) { stringBuilder.Append(GetQuantumDisruptorRevertInfo(i + 2, incrementalPrices[i])); } return stringBuilder.ToString(); } default: return string.Empty; } static float infoFunction(int level) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); return configuration.QUANTUM_DISRUPTOR_INITIAL_MULTIPLIER.Value + level * configuration.QUANTUM_DISRUPTOR_INCREMENTAL_MULTIPLIER.Value; } } internal (bool, string) CanRevertTime() { if (CurrentMode != UpgradeModes.RevertTime) { return (false, "This command is not available for selected '" + overridenUpgradeName + "' upgrade.\n"); } if (StartOfRound.Instance.inShipPhase) { return (false, "Cannot execute this command while in orbit.\n"); } if (!StartOfRound.Instance.shipHasLanded) { return (false, "Cannot execute this command while landing on a moon.\n"); } if (!TimeOfDay.Instance.currentDayTimeStarted) { return (false, "Cannot execute this command during a time freeze.\n"); } float globalTime = TimeOfDay.Instance.globalTime; globalTime -= TimeOfDay.Instance.lengthOfHours * (float)hoursToReduce; if (globalTime < 0f) { return (false, "This command cannot be executed due to the new time being before you started landing on the moon (Leads to negative time).\n"); } string text = string.Empty; switch (CurrentResetMode) { case ResetModes.MoonLanding: text = "Come back to orbit"; break; case ResetModes.MoonRerouting: text = "Route to a different moon"; break; case ResetModes.NewQuota: text = "Finish your current quota"; break; } return (currentUsages < availableUsages, "Reached maximum amount of usages during this moon trip. " + text + " to recharge the disruptor.\n"); } internal void TryResetValues(ResetModes requestedMode) { if (CurrentMode == UpgradeModes.RevertTime && CurrentResetMode == requestedMode) { ResetUsageCounterClientRpc(); } } internal static void TryResetQuantum(ResetModes mode) { LategameConfiguration configuration = BaseUpgrade.GetConfiguration(); if (SyncedEntry<bool>.op_Implicit(configuration.QUANTUM_DISRUPTOR_ENABLED) && ((NetworkBehaviour)Instance).IsHost) { In