Example #1
0
 /// <summary>
 ///     Constructor object for the Create Stars
 /// </summary>
 /// <param name="s">Our StarSystem</param>
 /// <param name="d">The Ddice we use</param>
 /// <param name="p">System Generation</param>
 public CreateStars( StarSystem s, Dice d, SystemGeneration p )
 {
     VelvetBag = d;
     OurSystem = s;
     InitializeComponent();
     SystemParent = p;
 }
Example #2
0
        /// <summary>
        ///     The constructor object for this form
        /// </summary>
        public CreatePlanets( StarSystem o, Dice d, SystemGeneration p )
        {
            OParent = p;
            VelvetBag = d;
            OurSystem = o;

            InitializeComponent();
        }
Example #3
0
 public static void ExportSystemToXml( StarSystem system, string path )
 {
     if (!File.Exists(path))
     {
         File.Create(path).Close();
     }
     var xDoc = new XDocument(new XElement("StarSystem", new XAttribute("Name", system.SysName)));
     xDoc.Save(path);
 }
Example #4
0
        /// <summary>
        ///     This function creates planets. (durr hurr). Only invoke after you've deteremined the orbitals.
        /// </summary>
        /// <param name="ourSystem">The star system we are creating for</param>
        /// <param name="ourPlanets">The orbitals we've created</param>
        /// <param name="velvetBag">Our Ddice object</param>
        public static void CreatePlanets( StarSystem ourSystem, List<Satellite> ourPlanets, Dice velvetBag )
        {
            var distanceTable = GenDistChart(ourSystem.SysStars);

            foreach (var s in ourPlanets)
            {
                if (s.BaseType == Satellite.BasetypeAsteroidbelt || s.BaseType == Satellite.BasetypeEmpty)
                {
                    if (s.BaseType == Satellite.BasetypeAsteroidbelt)
                    {
                        DetermineGeologicValues(s, velvetBag, ourSystem.SysAge, false);
                    }

                    continue;
                }

                double temp;
                var parent = ourSystem.GetValidParent(s.ParentId);

                //set physical properties
                s.GenGenericName(ourSystem.SysStars[parent].Name, ourSystem.SysName);
                s.GenWorldType(ourSystem.MaxMass, ourSystem.SysAge, velvetBag);

                s.GenDensity(velvetBag);
                s.GenPhysicalParameters(velvetBag);
                s.SetClimateData(ourSystem.MaxMass, velvetBag);
                s.DetSurfaceTemp(0);
                if (s.BaseType != Satellite.BasetypeGasgiant)
                {
                    s.CalcAtmPres();
                }

                s.CreateMoons(ourSystem.SysName, velvetBag, OptionCont.MoonOrbitFlag);

                s.GetPlanetEccentricity(ourSystem.SysStars[parent].GasGiantFlag, Star.SnowLine(ourSystem.SysStars[parent].InitLumin), velvetBag);
                s.GenerateOrbitalPeriod(ourSystem.SysStars[parent].CurrMass);
                s.CreateAxialTilt(velvetBag);

                foreach (var sun in from sun in ourSystem.SysStars let dist = DetermineDistance(s.OrbitalRadius, distanceTable, s.ParentId, sun.SelfId) select sun)
                {
                    temp = .46 * sun.CurrMass * s.Diameter / Math.Pow(s.OrbitalRadius, 3);
                    var tide = 0;

                    //add the correct flag.
                    if (sun.SelfId == Star.IsPrimary)
                    {
                        tide = Satellite.TidePrimarystar;
                    }
                    if (sun.SelfId == Star.IsSecondary)
                    {
                        tide = Satellite.TideSecondarystar;
                    }
                    if (sun.SelfId == Star.IsTrinary)
                    {
                        tide = Satellite.TideTrinarystar;
                    }
                    if (sun.SelfId == Star.IsSeccomp)
                    {
                        tide = Satellite.TideSeccompstar;
                    }
                    if (sun.SelfId == Star.IsTricomp)
                    {
                        tide = Satellite.TideTricompstar;
                    }

                    s.TideForce.Add(tide, temp);
                }

                if (s.MajorMoons.Count > 0)
                {
                    foreach (var moon in s.MajorMoons)
                    {
                        double lunarTides;
                        double different = 0;

                        moon.GenGenericName(s.Name, ourSystem.SysName);
                        //establish physical properties
                        moon.GenWorldType(ourSystem.MaxMass, ourSystem.SysAge, velvetBag);
                        if (s.BaseType == Satellite.BasetypeGasgiant)
                        {
                            //first, differentation test.
                            var dFactor = moon.GetDifferentationFactor(s.Mass, velvetBag);
                            if (dFactor > 100)
                            {
                                if (moon.SatelliteType == Satellite.SubtypeIce)
                                {
                                    moon.UpdateType(Satellite.SubtypeSulfur);
                                }
                                different = -.15;
                            }
                            if (dFactor > 80 && dFactor <= 100)
                            {
                                if (moon.SatelliteType == Satellite.SubtypeIce)
                                {
                                    moon.UpdateType(Satellite.SubtypeSulfur);
                                }
                                different = -.1;
                            }
                            if (dFactor > 50 && dFactor <= 80)
                            {
                                different = -.05;
                                moon.UpdateDescListing(Satellite.DescSubsurfocean);
                            }
                            if (dFactor > 30 && dFactor <= 50)
                            {
                                moon.UpdateDescListing(Satellite.DescSubsurfocean);
                            }
                        }

                        moon.GenDensity(velvetBag);
                        moon.GenPhysicalParameters(velvetBag);
                        moon.SetClimateData(ourSystem.MaxMass, velvetBag);
                        moon.DetSurfaceTemp(different);
                        moon.CalcAtmPres();

                        if (s.BaseType == Satellite.BasetypeGasgiant)
                        {
                            //radiation test
                            moon.UpdateDescListing(moon.AtmPres > .2 ? Satellite.DescRadHighback : Satellite.DescRadLethalback);
                        }

                        //orbital period
                        moon.GenerateOrbitalPeriod(s.Mass);

                        //update parent.
                        temp = 2230000 * moon.Mass * s.Diameter / Math.Pow(moon.OrbitalRadius, 3);
                        s.TideForce.Add(Satellite.TideMoonBase + moon.SelfId + 1, temp);

                        //moon tides
                        lunarTides = 2230000 * s.Mass * moon.Diameter / Math.Pow(moon.OrbitalRadius, 3);

                        lunarTides = lunarTides * ourSystem.SysAge / moon.Mass;
                        moon.TideForce.Add(Satellite.TideParplanet, lunarTides);
                        moon.TideTotal = moon.TotalTidalForce(ourSystem.SysAge);

                        if (moon.TideTotal >= 50 && velvetBag.GurpsRoll() > 17)
                        {
                            moon.IsResonant = true;
                        }
                        else if (moon.TideTotal >= 50)
                        {
                            moon.IsTideLocked = true;
                        }

                        moon.GenerateOrbitalVelocity(velvetBag);
                        if (moon.IsTideLocked && !moon.IsResonant)
                        {
                            UpdateTidalLock(moon, velvetBag);
                        }
                        if (moon.IsResonant)
                        {
                            moon.SiderealPeriod = moon.OrbitalPeriod * 2.0 / 3.0;
                            moon.RotationalPeriod = moon.SiderealPeriod;
                        }

                        if (velvetBag.GurpsRoll() >= 17)
                        {
                            moon.RetrogradeMotion = true;
                        }

                        if (moon.OrbitalPeriod == moon.SiderealPeriod)
                        {
                            moon.RotationalPeriod = 0;
                        }

                        else //calculate solar day from sidereal
                        {
                            double sidereal;
                            if (moon.RetrogradeMotion)
                            {
                                sidereal = -1 * moon.SiderealPeriod;
                            }
                            else
                            {
                                sidereal = moon.SiderealPeriod;
                            }

                            moon.RotationalPeriod = s.OrbitalPeriod * sidereal / ( s.OrbitalPeriod - sidereal );
                            moon.OrbitalCycle = moon.OrbitalPeriod * s.RotationalPeriod / ( moon.OrbitalPeriod - s.RotationalPeriod );
                        }
                        moon.CreateAxialTilt(velvetBag);
                        DetermineGeologicValues(moon, velvetBag, ourSystem.SysAge, s.BaseType == Satellite.BasetypeGasgiant);
                    }
                }

                //tides calculated already.
                s.TideTotal = s.TotalTidalForce(ourSystem.SysAge);
                if (s.TideTotal >= 50 && s.OrbitalEccent > .1)
                {
                    s.IsResonant = true;
                }
                else if (s.TideTotal >= 50)
                {
                    s.IsTideLocked = true;
                }

                s.GenerateOrbitalVelocity(velvetBag);

                if (s.IsTideLocked && !s.IsResonant)
                {
                    UpdateTidalLock(s, velvetBag);
                }
                if (s.IsResonant)
                {
                    s.SiderealPeriod = s.OrbitalPeriod * 2.0 / 3.0;
                    s.RotationalPeriod = s.SiderealPeriod;
                }

                if (velvetBag.GurpsRoll() >= 13)
                {
                    s.RetrogradeMotion = true;
                }
                if (s.OrbitalPeriod == s.SiderealPeriod)
                {
                    s.RotationalPeriod = 0;
                }

                else
                {
                    double sidereal;
                    if (s.RetrogradeMotion)
                    {
                        sidereal = -1 * s.SiderealPeriod;
                    }
                    else
                    {
                        sidereal = s.SiderealPeriod;
                    }

                    s.RotationalPeriod = s.OrbitalPeriod * sidereal / ( s.OrbitalPeriod - sidereal );
                }
                s.CreateAxialTilt(velvetBag);
                DetermineGeologicValues(s, velvetBag, ourSystem.SysAge, false);
            }
        }
Example #5
0
        /// <summary>
        ///     This function generates and populates our stars.
        /// </summary>
        /// <param name="ourBag">The Ddice object used for our PRNG</param>
        /// <param name="ourSystem">The solar system we are creating stars for</param>
        public static void CreateStars( Dice ourBag, StarSystem ourSystem )
        {
            var numStars = 0;

            //determine the number of stars
            if (OptionCont.GetNumberOfStars() != -1)
            {
                numStars = OptionCont.GetNumberOfStars();
            }
            else
            {
                // We take the roll, add 2 if it's in an open cluster,subtract 1 if not, then divide it by 5.
                // This matches the roll probablity to the table.
                numStars = (int) Math.Floor(( ourBag.GurpsRoll() + ( OptionCont.InOpenCluster ? 2 : -1 ) ) / 5.0);

                if (numStars < 1)
                {
                    numStars = 1;
                }
                if (numStars > 3)
                {
                    numStars = 3;
                }
            }

            //creating the stars.
            for (var i = 0; i < numStars; i++)
            {
                if (i == 0)
                {
                    ourSystem.AddStar(Star.IsPrimary, Star.IsPrimary, i);

                    //manually set the first star's mass and push it to the max mass setting
                    ourSystem.SysStars[0].UpdateMass(RollStellarMass(ourBag, Star.IsPrimary));
                    ourSystem.MaxMass = ourSystem.SysStars[0].CurrMass;

                    //generate the star
                    GenerateAStar(ourSystem.SysStars[i], ourBag, ourSystem.MaxMass, ourSystem.SysName);
                }
                if (i == 1)
                {
                    ourSystem.AddStar(Star.IsSecondary, Star.IsPrimary, i);
                    //generate the star
                    GenerateAStar(ourSystem.SysStars[i], ourBag, ourSystem.MaxMass, ourSystem.SysName);
                }
                if (i == 2)
                {
                    ourSystem.AddStar(Star.IsTrinary, Star.IsPrimary, i);
                    //generate the star
                    GenerateAStar(ourSystem.SysStars[i], ourBag, ourSystem.MaxMass, ourSystem.SysName);
                }

                GasGiantFlag(ourSystem.SysStars[i], ourBag.GurpsRoll());
            }

            //now generate orbitals
            if (ourSystem.CountStars() > 1)
            {
                PlaceOurStars(ourSystem, ourBag);
            }
        }
Example #6
0
        /// <summary>
        ///     This places our stars around the primary, as well as creating the secondary stars if called for
        /// </summary>
        /// <param name="ourSystem">The star system to be added to.</param>
        /// <param name="velvetBag">Our Ddice object.</param>
        private static void PlaceOurStars( StarSystem ourSystem, Dice velvetBag )
        {
            //initiate the variables we need to ensure distances are kept
            var maxOrbitalDistance = 600.0;
            var starLimit = ourSystem.SysStars.Count;
            for (var i = 1; i < starLimit; i++)
            {
                var modifiers = 0;
                var minOrbitalDistance = ourSystem.SysStars[i - 1].OrbitalRadius;

                //set the min and max conditions for the first star here.
                int roll;
                double tempVal;
                if (ourSystem.SysStars[i].ParentId == 0 || ourSystem.SysStars[i].ParentId == Star.IsPrimary)
                {
                    //apply modifiers
                    if (ourSystem.SysStars[i].SelfId == Star.IsTrinary)
                    {
                        modifiers = modifiers + 6;
                    }
                    if (OptionCont.ForceGardenFavorable != null)
                    {
                        if ((bool) OptionCont.ForceGardenFavorable && ourSystem.SysStars[i].ParentId == Star.IsPrimary)
                        {
                            modifiers = modifiers + 4;
                        }
                    }

                    if (minOrbitalDistance == 600.0)
                    {
                        //in this situation, orbital 3 or so can't be safely placed because the range is 0.
                        // so we autogenerate it.
                        tempVal = velvetBag.RollRange(25, 25);
                        ourSystem.SysStars[i].OrbitalSep = 5;
                        ourSystem.SysStars[ourSystem.Star2Index].OrbitalRadius = ourSystem.SysStars[ourSystem.Star2Index].OrbitalRadius - tempVal;
                        ourSystem.SysStars[i].OrbitalRadius = 600 + tempVal;
                        ourSystem.SysStars[i].DistFromPrimary = ourSystem.SysStars[i].OrbitalRadius;
                    }
                    else
                    {
                        do
                        {
                            //roll the Ddice and generate the orbital radius
                            do
                            {
                                roll = velvetBag.GurpsRoll(modifiers);
                                if (roll <= 6)
                                {
                                    ourSystem.SysStars[i].OrbitalSep = Star.OrbsepVeryclose;
                                }
                                if (roll >= 7 && roll <= 9)
                                {
                                    ourSystem.SysStars[i].OrbitalSep = Star.OrbsepClose;
                                }
                                if (roll >= 10 && roll <= 11)
                                {
                                    ourSystem.SysStars[i].OrbitalSep = Star.OrbsepModerate;
                                }
                                if (roll >= 12 && roll <= 14)
                                {
                                    ourSystem.SysStars[i].OrbitalSep = Star.OrbsepWide;
                                }
                                if (roll >= 15)
                                {
                                    ourSystem.SysStars[i].OrbitalSep = Star.OrbsepDistant;
                                }
                                tempVal = velvetBag.Rng(2, 6) * GetSepModifier(ourSystem.SysStars[i].OrbitalSep);
                            }
                            while (tempVal <= minOrbitalDistance);

                            //if (ourSystem.sysStars[i].selfID == 2) tempVal = this.velvetBag.six(1, 7) * ourSystem.sysStars[i].getSepModifier();
                            var lowerBound = tempVal - .5 * GetSepModifier(ourSystem.SysStars[i].OrbitalSep);
                            var higherBound = .5 * GetSepModifier(ourSystem.SysStars[i].OrbitalSep) + tempVal;

                            //set for constraints
                            if (lowerBound < minOrbitalDistance)
                            {
                                lowerBound = minOrbitalDistance;
                            }
                            if (higherBound > maxOrbitalDistance)
                            {
                                higherBound = maxOrbitalDistance;
                            }

                            ourSystem.SysStars[i].OrbitalRadius = tempVal;
                            ourSystem.SysStars[i].DistFromPrimary = ourSystem.SysStars[i].OrbitalRadius;
                        }
                        while (ourSystem.SysStars[i].OrbitalRadius <= minOrbitalDistance);

                        //let's see if it has a subcompanion
                        if (ourSystem.SysStars[i].OrbitalSep == Star.OrbsepDistant)
                        {
                            roll = velvetBag.GurpsRoll();
                            if (roll >= 11)
                            {
                                //generate the subcompanion
                                var order = 0;

                                if (ourSystem.SysStars[i].SelfId == Star.IsSecondary)
                                {
                                    order = Star.IsSeccomp;
                                }
                                if (ourSystem.SysStars[i].SelfId == Star.IsTrinary)
                                {
                                    order = Star.IsTricomp;
                                }

                                //add the star
                                ourSystem.AddStar(order, ourSystem.SysStars[i].SelfId, i + 1);

                                ourSystem.SysStars[starLimit].Name = Star.GenGenericName(ourSystem.SysName, i + 1);

                                //set the name, then generate the star
                                ourSystem.SysStars[starLimit].ParentName = ourSystem.SysStars[i].Name;
                                GenerateAStar(ourSystem.SysStars[starLimit], velvetBag, ourSystem.SysStars[i].CurrMass, ourSystem.SysName);
                                starLimit++; //increment the total number of stars we have generated
                            }
                        }
                    }
                }
                else
                {
                    maxOrbitalDistance = ourSystem.SysStars[ourSystem.GetStellarParentId(ourSystem.SysStars[i].ParentId)].OrbitalRadius;
                    //roll for seperation
                    do
                    {
                        //roll the Ddice

                        roll = velvetBag.GurpsRoll(-6);
                        if (roll <= 6)
                        {
                            ourSystem.SysStars[i].OrbitalSep = Star.OrbsepVeryclose;
                        }
                        if (roll >= 7 && roll <= 9)
                        {
                            ourSystem.SysStars[i].OrbitalSep = Star.OrbsepClose;
                        }
                        if (roll >= 10 && roll <= 11)
                        {
                            ourSystem.SysStars[i].OrbitalSep = Star.OrbsepModerate;
                        }
                        if (roll >= 12 && roll <= 14)
                        {
                            ourSystem.SysStars[i].OrbitalSep = Star.OrbsepWide;
                        }
                        if (roll >= 15)
                        {
                            ourSystem.SysStars[i].OrbitalSep = Star.OrbsepDistant;
                        }

                        //set the subcompanion orbital
                        tempVal = velvetBag.Rng(2, 6) * GetSepModifier(ourSystem.SysStars[i].OrbitalSep);
                        tempVal -= 0.5 * GetSepModifier(ourSystem.SysStars[i].OrbitalSep);
                        var higherBound = .5 * GetSepModifier(ourSystem.SysStars[i].OrbitalSep) + tempVal;

                        if (higherBound > maxOrbitalDistance)
                        {
                            higherBound = maxOrbitalDistance;
                        }

                        ourSystem.SysStars[i].OrbitalRadius = tempVal;
                        ourSystem.SysStars[i].DistFromPrimary = ourSystem.SysStars[i].OrbitalRadius + maxOrbitalDistance;
                    }
                    while (ourSystem.SysStars[i].OrbitalRadius > maxOrbitalDistance);
                }

                CalcEccentricity(velvetBag, ourSystem.SysStars[i]);

                var parent = ourSystem.GetStellarParentId(ourSystem.SysStars[i].ParentId);
                ourSystem.SysStars[i].OrbitalPeriod = Star.CalcOrbitalPeriod(ourSystem.SysStars[parent].CurrMass, ourSystem.SysStars[i].CurrMass, ourSystem.SysStars[i].OrbitalRadius);
            }
        }
Example #7
0
        public static void InsertSystem( StarSystem system )
        {
            using (var context = new Db1Entities())
            {
                var newSystem = new StarSystems
                {
                    sysName = system.SysName,
                    habitableZones = system.HabitableZones.Count,
                    maxMass = system.MaxMass,
                    numDwarfPlanets = system.NumDwarfPlanets,
                    star2index = system.Star2Index,
                    star3index = system.Star3Index,
                    subCompanionStar2index = system.SubCompanionStar2Index,
                    subCompanionStar3index = system.SubCompanionStar3Index,
                    sysAge = system.SysAge,
                    sysStars = system.SysStars.Count
                };
                foreach (var star in system.SysStars)
                {
                    var newStar = new Stars
                    {
                        currLumin = Math.Round(star.CurrLumin, 4),
                        distFromPrimary = star.DistFromPrimary,
                        effTemp = Math.Round(star.EffTemp, 4),
                        gasGiantFlag = star.GasGiantFlag,
                        initLumin = star.InitLumin,
                        initMass = star.InitMass,
                        isFlareStar = star.IsFlareStar,
                        name = star.Name,
                        orbitalEccent = star.OrbitalEccent,
                        orbitalPeriod = Math.Round(star.OrbitalPeriod, 4),
                        orbitalRadius = star.OrbitalRadius,
                        orbitalSep = star.OrbitalSep,
                        orderID = star.OrderId,
                        parentID = star.ParentId,
                        parentName = star.ParentName,
                        radius = Math.Round(star.GetRadiusAu(), 4),
                        selfID = star.SelfId,
                        specType = star.SpecType,
                        starAge = star.StarAge,
                        starColor = star.StarColor,
                        sysPlanets = star.SysPlanets.Count,
                        StarOrder = Star.GetDescFromFlag(star.SelfId)
                    };
                    newStar.StarOrder = star.ReturnCurrentBranchDesc();
                    newStar.OrbitalDetails = star.PrintOrbitalDetails();
                    newStar.StarString = star.ToString();

                    foreach (var sat in star.SysPlanets)
                    {
                        var newSatellite = new Planets();
                        var type = "";
                        var pressure = "";
                        if (OptionCont.ExpandAsteroidBelt != null && ( sat.BaseType != Satellite.BasetypeAsteroidbelt || (bool) OptionCont.ExpandAsteroidBelt ))
                        {
                            type = sat.DescSizeType();
                        }
                        if (sat.BaseType == Satellite.BasetypeAsteroidbelt)
                        {
                            type = "Asteroid Belt";
                        }

                        if (sat.BaseType == Satellite.BasetypeAsteroidbelt)
                        {
                            pressure = "None.";
                        }

                        if (sat.BaseType == Satellite.BasetypeGasgiant)
                        {
                            pressure = "Superdense Atmosphere.";
                        }

                        if (sat.BaseType == Satellite.BasetypeMoon || sat.BaseType == Satellite.BasetypeTerrestial)
                        {
                            pressure = sat.GetDescAtmCategory() + "(" + Math.Round(sat.AtmPres, 2) + ")";
                        }

                        newSatellite.SatelliteSize = sat.SatelliteSize;
                        newSatellite.SatelliteType = sat.SatelliteType;
                        newSatellite.atmCate = sat.AtmCate.Count;
                        newSatellite.atmMass = sat.AtmMass;
                        newSatellite.atmPres = pressure;
                        newSatellite.axialTilt = sat.AxialTilt;
                        newSatellite.baseType = sat.BaseType;
                        newSatellite.blackbodyTemp = sat.BlackbodyTemp;
                        newSatellite.dayFaceMod = Convert.ToInt32(sat.DayFaceMod);
                        newSatellite.density = sat.Density;
                        newSatellite.diameter = Math.Round(sat.DiameterInKm(), 2);
                        newSatellite.gravity = Math.Round(sat.Gravity * Satellite.Gforce, 2);
                        newSatellite.hydCoverage = sat.HydCoverage * 100 + "%";
                        newSatellite.innerMoonlets = sat.InnerMoonlets.Count;
                        newSatellite.isResonant = sat.IsResonant;
                        newSatellite.isTideLocked = sat.IsTideLocked;
                        newSatellite.majorMoons = sat.MajorMoons.Count;
                        newSatellite.mass = sat.Mass;
                        newSatellite.masterOrderID = sat.MasterOrderId;
                        newSatellite.moonRadius = sat.MoonRadius;
                        newSatellite.name = sat.Name;
                        newSatellite.nightFaceMod = Convert.ToInt32(sat.NightFaceMod);
                        newSatellite.orbitalCycle = sat.OrbitalCycle;
                        newSatellite.orbitalEccent = sat.OrbitalEccent;
                        newSatellite.orbitalPeriod = sat.OrbitalPeriod;
                        newSatellite.orbitalRadius = Math.Round(sat.OrbitalRadius, 2);
                        newSatellite.outerMoonlets = sat.OuterMoonlets.Count;
                        newSatellite.parentDiam = sat.ParentDiam;
                        newSatellite.parentID = sat.ParentId;
                        newSatellite.parentName = sat.ParentName;
                        newSatellite.retrogradeMotion = sat.RetrogradeMotion;
                        newSatellite.rotationalPeriod = sat.RotationalPeriod;
                        newSatellite.selfID = sat.SelfId;
                        newSatellite.siderealPeriod = sat.SiderealPeriod;
                        newSatellite.surfaceTemp = sat.SurfaceTemp;
                        newSatellite.tecActivity = sat.TecActivity;
                        newSatellite.tideTotal = sat.TideTotal;
                        newSatellite.volActivity = sat.VolActivity;
                        newSatellite.sattype = type;
                        newSatellite.atmnote = sat.DescAtm();
                        newSatellite.RVM = sat.GetRvmDesc();
                        newSatellite.planetString = sat.ToString();

                        foreach (var innerMoonlet in sat.InnerMoonlets)
                        {
                            var newInnerMoonlet = new InnerMoonlets
                            {
                                blackbodyTemp = innerMoonlet.BlackbodyTemp,
                                name = innerMoonlet.Name,
                                orbitalEccent = innerMoonlet.OrbitalEccent,
                                orbitalPeriod = innerMoonlet.OrbitalPeriod,
                                orbitalRadius = Math.Round(innerMoonlet.OrbitalRadius, 2),
                                parentID = innerMoonlet.ParentId,
                                parentName = innerMoonlet.ParentName,
                                planetRadius = innerMoonlet.PlanetRadius,
                                selfID = innerMoonlet.SelfId,
                                innerMoonString = innerMoonlet.ToString()
                            };
                            newSatellite.InnerMoonlets1.Add(newInnerMoonlet);
                        }
                        foreach (var outerMoonlet in sat.OuterMoonlets)
                        {
                            var newOuterMoonlet = new OuterMoonlets
                            {
                                blackbodyTemp = outerMoonlet.BlackbodyTemp,
                                name = outerMoonlet.Name,
                                orbitalEccent = outerMoonlet.OrbitalEccent,
                                orbitalPeriod = outerMoonlet.OrbitalPeriod,
                                orbitalRadius = Math.Round(outerMoonlet.OrbitalRadius, 2),
                                parentID = outerMoonlet.ParentId,
                                parentName = outerMoonlet.ParentName,
                                planetRadius = outerMoonlet.PlanetRadius,
                                selfID = outerMoonlet.SelfId,
                                outerMoonString = outerMoonlet.ToString()
                            };
                            newSatellite.OuterMoonlets1.Add(newOuterMoonlet);
                        }
                        foreach (var majorMoon in sat.MajorMoons)
                        {
                            var newMajorMoon = new MajorMoons
                            {
                                RVM = majorMoon.Rvm,
                                SatelliteSize = majorMoon.SatelliteSize,
                                SatelliteType = majorMoon.SatelliteType,
                                atmCate = majorMoon.AtmCate.Count,
                                atmMass = majorMoon.AtmMass,
                                axialTilt = majorMoon.AxialTilt,
                                baseType = majorMoon.BaseType,
                                blackbodyTemp = majorMoon.BlackbodyTemp,
                                dayFaceMod = Convert.ToInt32(majorMoon.DayFaceMod),
                                density = majorMoon.Density,
                                diameter = Math.Round(majorMoon.DiameterInKm(), 2),
                                gravity = Math.Round(majorMoon.Gravity * Satellite.Gforce, 2),
                                hydCoverage = sat.HydCoverage * 100 + "%",
                                innerMoonlets = majorMoon.InnerMoonlets.Count,
                                isResonant = majorMoon.IsResonant,
                                isTideLocked = majorMoon.IsTideLocked,
                                majorMoons1 = majorMoon.MajorMoons.Count,
                                mass = majorMoon.Mass,
                                moonRadius = majorMoon.MoonRadius,
                                name = majorMoon.Name,
                                nightFaceMod = Convert.ToInt32(majorMoon.NightFaceMod),
                                orbitalCycle = majorMoon.OrbitalCycle,
                                orbitalEccent = majorMoon.OrbitalEccent,
                                orbitalPeriod = majorMoon.OrbitalPeriod,
                                orbitalRadius = Math.Round(majorMoon.OrbitalRadius, 2),
                                outerMoonlets = majorMoon.OuterMoonlets.Count,
                                parentDiam = majorMoon.ParentDiam,
                                parentID = majorMoon.ParentId,
                                parentName = majorMoon.ParentName,
                                retrogradeMotion = majorMoon.RetrogradeMotion,
                                rotationalPeriod = majorMoon.RotationalPeriod,
                                selfID = majorMoon.SelfId,
                                siderealPeriod = majorMoon.SiderealPeriod,
                                surfaceTemp = majorMoon.SurfaceTemp,
                                tecActivity = majorMoon.TecActivity,
                                tideForce = majorMoon.TideForce.Count,
                                tideTotal = majorMoon.TideTotal,
                                volActivity = majorMoon.VolActivity,
                                MajorMoonString = majorMoon.ToString()
                            };
                            newSatellite.MajorMoons1.Add(newMajorMoon);
                        }
                        newStar.Planets.Add(newSatellite);
                    }
                    context.Stars.Add(newStar);
                }
                context.StarSystems.Add(newSystem);
                context.SaveChanges();
            }
        }
Example #8
0
 public CreateStars( StarSystem s, Dice d )
 {
     VelvetBag = d;
     OurSystem = s;
     InitializeComponent();
 }