Пример #1
0
        public static double ParseReconditioningFormula(KCT_BuildListVessel vessel, bool isReconditioning)
        {
            Dictionary <string, string> variables = new Dictionary <string, string>();

            double loadedMass, emptyMass, loadedCost, emptyCost;

            loadedCost = vessel.cost;
            emptyCost  = vessel.emptyCost;
            loadedMass = vessel.GetTotalMass();
            emptyMass  = vessel.emptyMass;

            int EditorLevel = 0, LaunchSiteLvl = 0, EditorMax = 0, LaunchSiteMax = 0;
            int isVABVessel = 0;

            if (vessel.type == KCT_BuildListVessel.ListType.VAB)
            {
                EditorLevel   = KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.VehicleAssemblyBuilding);
                LaunchSiteLvl = KCT_GameStates.ActiveKSC.ActiveLPInstance.level;//KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.LaunchPad);
                EditorMax     = KCT_Utilities.BuildingUpgradeMaxLevel(SpaceCenterFacility.VehicleAssemblyBuilding);
                LaunchSiteMax = KCT_Utilities.BuildingUpgradeMaxLevel(SpaceCenterFacility.LaunchPad);
                isVABVessel   = 1;
            }
            else
            {
                EditorLevel   = KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.SpaceplaneHangar);
                LaunchSiteLvl = KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.Runway);
                EditorMax     = KCT_Utilities.BuildingUpgradeMaxLevel(SpaceCenterFacility.SpaceplaneHangar);
                LaunchSiteMax = KCT_Utilities.BuildingUpgradeMaxLevel(SpaceCenterFacility.Runway);
            }
            double BP          = vessel.buildPoints;
            double OverallMult = KCT_PresetManager.Instance.ActivePreset.timeSettings.OverallMultiplier;
            double ReconEffect = KCT_PresetManager.Instance.ActivePreset.timeSettings.ReconditioningEffect;
            double MaxRecon    = KCT_PresetManager.Instance.ActivePreset.timeSettings.MaxReconditioning;

            variables.Add("M", loadedMass.ToString());
            variables.Add("m", emptyMass.ToString());
            variables.Add("C", loadedCost.ToString());
            variables.Add("c", emptyCost.ToString());
            variables.Add("VAB", isVABVessel.ToString());
            variables.Add("BP", BP.ToString());
            variables.Add("L", LaunchSiteLvl.ToString());
            variables.Add("LM", LaunchSiteMax.ToString());
            variables.Add("EL", EditorLevel.ToString());
            variables.Add("ELM", EditorMax.ToString());
            variables.Add("O", OverallMult.ToString());
            variables.Add("E", ReconEffect.ToString());
            variables.Add("X", MaxRecon.ToString());
            int isRecon = isReconditioning ? 1 : 0;

            variables.Add("RE", isRecon.ToString());
            variables.Add("S", KCT_PresetManager.Instance.ActivePreset.timeSettings.RolloutReconSplit.ToString());
            variables.Add("SN", vessel.numStages.ToString());
            variables.Add("SP", vessel.numStageParts.ToString());
            variables.Add("SC", vessel.stagePartCost.ToString());

            AddCrewVariables(variables);

            return(GetStandardFormulaValue("Reconditioning", variables));
        }
Пример #2
0
        public static double ParseRolloutCostFormula(KCT_BuildListVessel vessel)
        {
            if (!KCT_PresetManager.Instance.ActivePreset.generalSettings.Enabled || !KCT_PresetManager.Instance.ActivePreset.generalSettings.ReconditioningTimes)
            {
                return(0);
            }

            double loadedMass, emptyMass, loadedCost, emptyCost;

            loadedCost = vessel.GetTotalCost();
            emptyCost  = vessel.emptyCost;
            loadedMass = vessel.GetTotalMass();
            emptyMass  = vessel.emptyMass;

            int EditorLevel = 0, LaunchSiteLvl = 0, EditorMax = 0, LaunchSiteMax = 0;
            int isVABVessel = 0;

            if (vessel.type == KCT_BuildListVessel.ListType.None)
            {
                vessel.FindTypeFromLists();
            }
            if (vessel.type == KCT_BuildListVessel.ListType.VAB)
            {
                EditorLevel   = KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.VehicleAssemblyBuilding);
                LaunchSiteLvl = KCT_GameStates.ActiveKSC.ActiveLPInstance.level;//KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.LaunchPad);
                EditorMax     = KCT_Utilities.BuildingUpgradeMaxLevel(SpaceCenterFacility.VehicleAssemblyBuilding);
                LaunchSiteMax = KCT_Utilities.BuildingUpgradeMaxLevel(SpaceCenterFacility.LaunchPad);
                isVABVessel   = 1;
            }
            else if (vessel.type == KCT_BuildListVessel.ListType.SPH)
            {
                EditorLevel   = KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.SpaceplaneHangar);
                LaunchSiteLvl = KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.Runway);
                EditorMax     = KCT_Utilities.BuildingUpgradeMaxLevel(SpaceCenterFacility.SpaceplaneHangar);
                LaunchSiteMax = KCT_Utilities.BuildingUpgradeMaxLevel(SpaceCenterFacility.Runway);
            }
            double BP = vessel.buildPoints;

            Dictionary <string, string> variables = new Dictionary <string, string>();

            variables.Add("M", loadedMass.ToString());
            variables.Add("m", emptyMass.ToString());
            variables.Add("C", loadedCost.ToString());
            variables.Add("c", emptyCost.ToString());
            variables.Add("VAB", isVABVessel.ToString());
            variables.Add("BP", BP.ToString());
            variables.Add("L", LaunchSiteLvl.ToString());
            variables.Add("LM", LaunchSiteMax.ToString());
            variables.Add("EL", EditorLevel.ToString());
            variables.Add("ELM", EditorMax.ToString());
            variables.Add("SN", vessel.numStages.ToString());
            variables.Add("SP", vessel.numStageParts.ToString());
            variables.Add("SC", vessel.stagePartCost.ToString());

            AddCrewVariables(variables);

            return(GetStandardFormulaValue("RolloutCost", variables));
        }
Пример #3
0
        private static Dictionary <string, string> GetIntegrationRolloutVariables(KCT_BuildListVessel vessel)
        {
            double loadedMass, emptyMass, loadedCost, emptyCost;

            loadedCost = vessel.cost;
            emptyCost  = vessel.emptyCost;
            loadedMass = vessel.GetTotalMass();
            emptyMass  = vessel.emptyMass;

            int EditorLevel = 0, LaunchSiteLvl = 0, EditorMax = 0, LaunchSiteMax = 0;
            int isVABVessel = 0;

            if (vessel.type == KCT_BuildListVessel.ListType.None)
            {
                vessel.FindTypeFromLists();
            }
            if (vessel.type == KCT_BuildListVessel.ListType.VAB)
            {
                EditorLevel   = KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.VehicleAssemblyBuilding);
                LaunchSiteLvl = KCT_GameStates.ActiveKSC.ActiveLPInstance.level;//KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.LaunchPad);
                EditorMax     = KCT_Utilities.BuildingUpgradeMaxLevel(SpaceCenterFacility.VehicleAssemblyBuilding);
                LaunchSiteMax = KCT_Utilities.BuildingUpgradeMaxLevel(SpaceCenterFacility.LaunchPad);
                isVABVessel   = 1;
            }
            else if (vessel.type == KCT_BuildListVessel.ListType.SPH)
            {
                EditorLevel   = KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.SpaceplaneHangar);
                LaunchSiteLvl = KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.Runway);
                EditorMax     = KCT_Utilities.BuildingUpgradeMaxLevel(SpaceCenterFacility.SpaceplaneHangar);
                LaunchSiteMax = KCT_Utilities.BuildingUpgradeMaxLevel(SpaceCenterFacility.Runway);
            }
            double BP          = vessel.buildPoints;
            double OverallMult = KCT_PresetManager.Instance.ActivePreset.timeSettings.OverallMultiplier;

            Dictionary <string, string> variables = new Dictionary <string, string>();

            variables.Add("M", loadedMass.ToString());
            variables.Add("m", emptyMass.ToString());
            variables.Add("C", loadedCost.ToString());
            variables.Add("c", emptyCost.ToString());
            variables.Add("VAB", isVABVessel.ToString());
            variables.Add("E", vessel.effectiveCost.ToString());
            variables.Add("BP", BP.ToString());
            variables.Add("L", LaunchSiteLvl.ToString());
            variables.Add("LM", LaunchSiteMax.ToString());
            variables.Add("EL", EditorLevel.ToString());
            variables.Add("ELM", EditorMax.ToString());
            variables.Add("O", OverallMult.ToString());
            variables.Add("SN", vessel.numStages.ToString());
            variables.Add("SP", vessel.numStageParts.ToString());
            variables.Add("SC", vessel.stagePartCost.ToString());

            AddCrewVariables(variables);

            return(variables);
        }
Пример #4
0
        public static double ParseBuildRateFormula(KCT_BuildListVessel.ListType type, int index, KCT_KSC KSC, bool UpgradedRates = false)
        {
            //N = num upgrades, I = rate index, L = VAB/SPH upgrade level, R = R&D level
            int level = 0, upgrades = 0, levelMax = 0;
            Dictionary <string, string> variables = new Dictionary <string, string>();

            if (type == KCT_BuildListVessel.ListType.VAB)
            {
                level    = KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.VehicleAssemblyBuilding);
                levelMax = KCT_Utilities.BuildingUpgradeMaxLevel(SpaceCenterFacility.VehicleAssemblyBuilding);
                if (KSC.VABUpgrades.Count > index)
                {
                    upgrades = KSC.VABUpgrades[index];
                }
            }
            else if (type == KCT_BuildListVessel.ListType.SPH)
            {
                level    = KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.SpaceplaneHangar);
                levelMax = KCT_Utilities.BuildingUpgradeMaxLevel(SpaceCenterFacility.SpaceplaneHangar);
                if (KSC.SPHUpgrades.Count > index)
                {
                    upgrades = KSC.SPHUpgrades[index];
                }
            }
            if (UpgradedRates)
            {
                upgrades++;
            }
            variables.Add("L", level.ToString());
            variables.Add("LM", level.ToString());
            variables.Add("N", upgrades.ToString());
            variables.Add("I", index.ToString());
            variables.Add("R", KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.ResearchAndDevelopment).ToString());
            //int numNodes = RDController.Instance != null ? RDController.Instance.nodes.FindAll(n => n.IsResearched).Count : 0;
            int numNodes = 0;

            if (ResearchAndDevelopment.Instance != null)
            {
                numNodes = ResearchAndDevelopment.Instance.snapshot.GetData().GetNodes("Tech").Length;
            }
            variables.Add("S", numNodes.ToString());

            AddCrewVariables(variables);

            return(GetStandardFormulaValue("BuildRate", variables));
        }
Пример #5
0
        public static double ParseNodeRateFormula(double ScienceValue, int index, int upgradeDelta)
        {
            int RnDLvl   = KCT_Utilities.BuildingUpgradeLevel(SpaceCenterFacility.ResearchAndDevelopment);
            int RnDMax   = KCT_Utilities.BuildingUpgradeMaxLevel(SpaceCenterFacility.ResearchAndDevelopment);
            int upgrades = KCT_GameStates.TechUpgradesTotal + upgradeDelta;
            Dictionary <string, string> variables = new Dictionary <string, string>();

            variables.Add("S", ScienceValue.ToString());
            variables.Add("N", upgrades.ToString());
            variables.Add("R", RnDLvl.ToString());
            variables.Add("RM", RnDMax.ToString());
            variables.Add("O", KCT_PresetManager.Instance.ActivePreset.timeSettings.OverallMultiplier.ToString());
            variables.Add("I", index.ToString());

            AddCrewVariables(variables);

            return(GetStandardFormulaValue("Node", variables));
        }