Exemplo n.º 1
0
        internal static DMAnomalyParameter fetchAnomalyParameter(CelestialBody Body, DMAnomalyObject City, DMScienceContainer DMScience)
        {
            AvailablePart               aPart;
            ExperimentSituations        targetSituation;
            List <ExperimentSituations> situations;
            string name;

            name = DMUtils.availableScience["All"].FirstOrDefault(n => n.Value == DMScience).Key;

            if (DMScience.exp == null)
            {
                return(null);
            }

            //Determine if the science part is available if applicable
            if (DMScience.sciPart != "None")
            {
                DMUtils.DebugLog("Checking For Part {0} Now", DMScience.sciPart);
                aPart = PartLoader.getPartInfoByName(DMScience.sciPart);
                if (aPart == null)
                {
                    return(null);
                }
                if (!ResearchAndDevelopment.PartModelPurchased(aPart))
                {
                    return(null);
                }
                DMUtils.DebugLog("Part: [{0}] Purchased; Contract Meets Requirements", aPart.name);
            }

            if ((situations = DMUtils.availableSituationsLimited(DMScience.exp, DMScience.sitMask, Body)).Count == 0)
            {
                return(null);
            }
            else
            {
                DMUtils.DebugLog("Acceptable Situations Found");
                targetSituation = situations[rand.Next(0, situations.Count)];
                DMUtils.DebugLog("Experimental Situation: {0}", targetSituation);
            }

            return(new DMAnomalyParameter(Body, City, targetSituation, name));
        }
Exemplo n.º 2
0
        internal static DMAnomalyParameter fetchAnomalyParameter(CelestialBody Body, DMScienceContainer DMScience)
        {
            ExperimentSituations        targetSituation;
            List <ExperimentSituations> situations;
            string name;

            if (!DMUtils.availableScience.ContainsKey("All"))
            {
                return(null);
            }

            name = DMUtils.availableScience["All"].FirstOrDefault(n => n.Value == DMScience).Key;

            if (DMScience.Exp == null)
            {
                return(null);
            }

            //Determine if the science part is available if applicable
            if (DMScience.SciPart != "None")
            {
                if (!DMUtils.partAvailable(new List <string>(1)
                {
                    DMScience.SciPart
                }))
                {
                    return(null);
                }
            }

            if ((situations = DMUtils.availableSituationsLimited(DMScience.Exp, (int)DMScience.Exp.situationMask, Body)).Count == 0)
            {
                return(null);
            }
            else
            {
                targetSituation = situations[rand.Next(0, situations.Count)];
            }

            return(new DMAnomalyParameter(targetSituation, name));
        }
Exemplo n.º 3
0
        internal static DMAnomalyParameter fetchAnomalyParameter(CelestialBody Body, DMScienceContainer DMScience)
        {
            AvailablePart               aPart;
            ExperimentSituations        targetSituation;
            List <ExperimentSituations> situations;
            string name;

            name = DMUtils.availableScience["All"].FirstOrDefault(n => n.Value == DMScience).Key;

            if (DMScience.Exp == null)
            {
                return(null);
            }

            //Determine if the science part is available if applicable
            if (DMScience.SciPart != "None")
            {
                aPart = PartLoader.getPartInfoByName(DMScience.SciPart);
                if (aPart == null)
                {
                    return(null);
                }
                if (!ResearchAndDevelopment.PartModelPurchased(aPart))
                {
                    return(null);
                }
            }

            if ((situations = DMUtils.availableSituationsLimited(DMScience.Exp, DMScience.SitMask, Body)).Count == 0)
            {
                return(null);
            }
            else
            {
                targetSituation = situations[rand.Next(0, situations.Count)];
            }

            return(new DMAnomalyParameter(targetSituation, name));
        }