예제 #1
0
        //GalaxySeed = 14171500;
        //StarSeed = 1826783713
        static void Main()
        {
            DateTime StartTime = DateTime.Now;
            GameDesc gameDesc  = new GameDesc
            {
                starCount = 64
            };
            ThemeProtoSet themes = ThemeWorks.GetThemes();
            int           length = themes.dataArray.Length;

            gameDesc.themeIds = new int[length];
            ParallelOptions options = new ParallelOptions();

            options.MaxDegreeOfParallelism = 50;



            for (int index = 0; index < length; ++index)
            {
                gameDesc.themeIds[index] = themes.dataArray[index].ID;
            }

            int StartSeed = 73295657;
            int EndSeed   = 73295657;

            Parallel.For(
                StartSeed,
                EndSeed + 1,
                options,
                (i, loopState) =>
            {
                System.Console.WriteLine("StartLoop " + i.ToString("D8"));
                gameDesc.galaxySeed       = i;
                MUniverseGen MUniverseGen = new MUniverseGen();
                GalaxyData galaxyData     = MUniverseGen.CreateGalaxy(gameDesc);
                System.Console.WriteLine("Seed: " + galaxyData.seed.ToString("D8") + " BirthStar: " + galaxyData.stars[0].displayName);
            }

                );

            //for (int i = StartSeed; i < EndSeed+1; i++)
            //{
            //    gameDesc.galaxySeed = i;
            //    GalaxyData galaxyData = MUniverseGen.CreateGalaxy(gameDesc);
            //    System.Console.WriteLine("Seed: " + galaxyData.seed.ToString("D8") + " BirthStar: "+galaxyData.stars[0].displayName);
            //    //System.Console.WriteLine("START: " + galaxyData.stars[0].displayName);
            //    //System.Console.WriteLine("BH: " + galaxyData.stars[63].displayName);
            //    //System.Console.WriteLine("BH: " + galaxyData.stars[63].position.magnitude);
            //}



            DateTime EndTime = DateTime.Now;

            System.Console.WriteLine("Finished");
            Console.WriteLine("Time Used: " + EndTime.Subtract(StartTime).TotalSeconds + "Seconds");
            Console.WriteLine("Seed Calculated: " + (EndSeed - StartSeed + 1));
            System.Console.ReadLine();
        }
예제 #2
0
 public static ThemeProtoSet GetThemes()
 {
     if (uniqueInstance == null)
     {
         uniqueInstance = new ThemeWorks();
         XmlSerializer serializer = new XmlSerializer(typeof(ThemeProtoSet));
         ThemeProtoSet themes     = (ThemeProtoSet)serializer.Deserialize(new XmlTextReader("ThemeProtoSet.xml"));
         uniqueInstance.Theme = themes;
     }
     return(uniqueInstance.Theme);
 }
예제 #3
0
    //private int[] tmp_state;

    public GalaxyData CreateGalaxy(GameDesc gameDesc)
    {
        int     galaxySeed = gameDesc.galaxySeed;
        int     starCount  = gameDesc.starCount;
        StarGen StarGen    = new StarGen();

        Random     random    = new Random(galaxySeed);
        int        tempPoses = this.GenerateTempPoses(random.Next(), starCount, 4, 2.0, 2.3, 3.5, 0.18);
        GalaxyData galaxy    = new GalaxyData();

        galaxy.seed      = galaxySeed;
        galaxy.starCount = tempPoses;
        galaxy.stars     = new StarData[tempPoses];
        //Assert.Positive(tempPoses);
        if (tempPoses <= 0)
        {
            return(galaxy);
        }
        float num1  = (float)random.NextDouble();
        float num2  = (float)random.NextDouble();
        float num3  = (float)random.NextDouble();
        float num4  = (float)random.NextDouble();
        int   num5  = Mathf.CeilToInt((float)(0.00999999977648258 * (double)tempPoses + (double)num1 * 0.300000011920929));
        int   num6  = Mathf.CeilToInt((float)(0.00999999977648258 * (double)tempPoses + (double)num2 * 0.300000011920929));
        int   num7  = Mathf.CeilToInt((float)(0.0160000007599592 * (double)tempPoses + (double)num3 * 0.400000005960464));
        int   num8  = Mathf.CeilToInt((float)(0.0130000002682209 * (double)tempPoses + (double)num4 * 1.39999997615814));
        int   num9  = tempPoses - num5;
        int   num10 = num9 - num6;
        int   num11 = num10 - num7;
        int   num12 = (num11 - 1) / num8;
        int   num13 = num12 / 2;

        for (int index = 0; index < tempPoses; ++index)
        {
            int seed = random.Next();
            if (index == 0)
            {
                //生成母星系
                galaxy.stars[index] = StarGen.CreateBirthStar(galaxy, seed);
            }
            else
            {
                ESpectrType needSpectr = ESpectrType.X;
                if (index == 3)
                {
                    needSpectr = ESpectrType.M;
                }
                else if (index == num11 - 1)
                {
                    needSpectr = ESpectrType.O;
                }
                EStarType needtype = EStarType.MainSeqStar;
                if (index % num12 == num13)
                {
                    needtype = EStarType.GiantStar;
                }
                if (index >= num9)
                {
                    needtype = EStarType.BlackHole;
                }
                else if (index >= num10)
                {
                    needtype = EStarType.NeutronStar;
                }
                else if (index >= num11)
                {
                    needtype = EStarType.WhiteDwarf;
                }
                galaxy.stars[index] = StarGen.CreateStar(galaxy, this.tmp_poses[index], index + 1, seed, needtype, needSpectr);
            }
        }
        //AstroPose[] astroPoses = galaxy.astroPoses;


        StarData[] stars = galaxy.stars;
        //for (int index = 0; index < galaxy.astroPoses.Length; ++index)
        //{
        //    astroPoses[index].uRot.w = 1f;
        //    astroPoses[index].uRotNext.w = 1f;
        //}


        for (int index = 0; index < tempPoses; ++index)
        {
            StarGen.CreateStarPlanets(galaxy, stars[index], gameDesc);
            //astroPoses[stars[index].id * 100].uPos = astroPoses[stars[index].id * 100].uPosNext = stars[index].uPosition;
            //astroPoses[stars[index].id * 100].uRot = astroPoses[stars[index].id * 100].uRotNext = Quaternion.identity;
            //astroPoses[stars[index].id * 100].uRadius = stars[index].physicsRadius;
        }
        //galaxy.UpdatePoses(0.0);


        galaxy.birthPlanetId = 0;
        if (tempPoses > 0)
        {
            StarData starData = stars[0];
            for (int index = 0; index < starData.planetCount; ++index)
            {
                PlanetData    planet     = starData.planets[index];
                ThemeProtoSet themes     = ThemeWorks.GetThemes();
                var           themeProto = themes.dataArray[planet.theme - 1];
                if (themeProto != null && themeProto.Distribute == EThemeDistribute.Birth)
                {
                    galaxy.birthPlanetId = planet.id;
                    galaxy.birthStarId   = starData.id;
                    break;
                }
            }
        }
        //Assert.Positive(galaxy.birthPlanetId);
        for (int index1 = 0; index1 < tempPoses; ++index1)
        {
            StarData star = galaxy.stars[index1];
            for (int index2 = 0; index2 < star.planetCount; ++index2)
            {
                PlanetModelingManager.Algorithm(star.planets[index2]).GenerateVeins(true);
            }
        }
        //MUniverseGen.CreateGalaxyStarGraph(galaxy);
        return(galaxy);
    }
예제 #4
0
    //public abstract void GenerateTerrain(double modX, double modY);

    //public abstract void GenerateVegetables();

    //public virtual void CalcWaterPercent()
    //{
    //    if (this.planet.type == EPlanetType.Gas)
    //        this.planet.windStrength = 0.0f;
    //    PlanetAlgorithm.CalcLandPercent(this.planet);
    //}

    public virtual void GenerateVeins(bool sketchOnly)
    {
        //lock ((object)this.planet)
        //{
        ThemeProtoSet themes     = ThemeWorks.GetThemes();
        var           themeProto = themes.dataArray[this.planet.theme - 1];

        if (themeProto == null)
        {
            return;
        }
        Random random1 = new Random(this.planet.seed);

        random1.Next();
        random1.Next();
        random1.Next();
        random1.Next();
        int    _birthSeed = random1.Next();
        Random random2    = new Random(random1.Next());
        //PlanetRawData data = this.planet.data;
        float num1      = 2.1f / this.planet.radius;
        int   VeinCount = 15;

        //VeinProto[] veinProtos = PlanetModelingManager.veinProtos;
        //int[] veinModelIndexs = PlanetModelingManager.veinModelIndexs;
        //int[] veinModelCounts = PlanetModelingManager.veinModelCounts;
        //int[] veinProducts = PlanetModelingManager.veinProducts;
        int[]   numArray1 = new int[VeinCount];
        float[] numArray2 = new float[VeinCount];
        float[] numArray3 = new float[VeinCount];
        if (themeProto.VeinSpot != null)
        {
            Array.Copy((Array)themeProto.VeinSpot, 0, (Array)numArray1, 1, Math.Min(themeProto.VeinSpot.Length, numArray1.Length - 1));
        }
        if (themeProto.VeinCount != null)
        {
            Array.Copy((Array)themeProto.VeinCount, 0, (Array)numArray2, 1, Math.Min(themeProto.VeinCount.Length, numArray2.Length - 1));
        }
        if (themeProto.VeinOpacity != null)
        {
            Array.Copy((Array)themeProto.VeinOpacity, 0, (Array)numArray3, 1, Math.Min(themeProto.VeinOpacity.Length, numArray3.Length - 1));
        }
        float       p      = 1f;
        ESpectrType spectr = this.planet.star.spectr;

        switch (this.planet.star.type)
        {
        case EStarType.MainSeqStar:
            switch (spectr)
            {
            case ESpectrType.M:
                p = 2.5f;
                break;

            case ESpectrType.K:
                p = 1f;
                break;

            case ESpectrType.G:
                p = 0.7f;
                break;

            case ESpectrType.F:
                p = 0.6f;
                break;

            case ESpectrType.A:
                p = 1f;
                break;

            case ESpectrType.B:
                p = 0.4f;
                break;

            case ESpectrType.O:
                p = 1.6f;
                break;
            }
            break;

        case EStarType.GiantStar:
            p = 2.5f;
            break;

        case EStarType.WhiteDwarf:
            p = 3.5f;
            ++numArray1[9];
            ++numArray1[9];
            for (int index = 1; index < 12 && random1.NextDouble() < 0.449999988079071; ++index)
            {
                ++numArray1[9];
            }
            numArray2[9] = 0.7f;
            numArray3[9] = 1f;
            ++numArray1[10];
            ++numArray1[10];
            for (int index = 1; index < 12 && random1.NextDouble() < 0.449999988079071; ++index)
            {
                ++numArray1[10];
            }
            numArray2[10] = 0.7f;
            numArray3[10] = 1f;
            ++numArray1[12];
            for (int index = 1; index < 12 && random1.NextDouble() < 0.5; ++index)
            {
                ++numArray1[12];
            }
            numArray2[12] = 0.7f;
            numArray3[12] = 0.3f;
            break;

        case EStarType.NeutronStar:
            p = 4.5f;
            ++numArray1[14];
            for (int index = 1; index < 12 && random1.NextDouble() < 0.649999976158142; ++index)
            {
                ++numArray1[14];
            }
            numArray2[14] = 0.7f;
            numArray3[14] = 0.3f;
            break;

        case EStarType.BlackHole:
            p = 5f;
            ++numArray1[14];
            for (int index = 1; index < 12 && random1.NextDouble() < 0.649999976158142; ++index)
            {
                ++numArray1[14];
            }
            numArray2[14] = 0.7f;
            numArray3[14] = 0.3f;
            break;
        }
        for (int index1 = 0; index1 < themeProto.RareVeins.Length; ++index1)
        {
            int   rareVein     = themeProto.RareVeins[index1];
            float num2         = this.planet.star.index != 0 ? themeProto.RareSettings[index1 * 4 + 1] : themeProto.RareSettings[index1 * 4];
            float rareSetting1 = themeProto.RareSettings[index1 * 4 + 2];
            float rareSetting2 = themeProto.RareSettings[index1 * 4 + 3];
            float num3         = rareSetting2;
            float num4         = 1f - Mathf.Pow(1f - num2, p);
            float num5         = 1f - Mathf.Pow(1f - rareSetting2, p);
            float num6         = 1f - Mathf.Pow(1f - num3, p);
            if (random1.NextDouble() < (double)num4)
            {
                ++numArray1[rareVein];
                numArray2[rareVein] = num5;
                numArray3[rareVein] = num5;
                for (int index2 = 1; index2 < 12 && random1.NextDouble() < (double)rareSetting1; ++index2)
                {
                    ++numArray1[rareVein];
                }
            }
        }
        bool flag1 = this.planet.galaxy.birthPlanetId == this.planet.id;
        //if (flag1 && !sketchOnly)
        //    this.planet.GenBirthPoints(data, _birthSeed);
        float resourceCoef = this.planet.star.resourceCoef;

        //
        //bool flag2 = (double)DSPGame.GameDesc.resourceMultiplier >= 99.5;
        if (flag1)
        {
            resourceCoef *= 0.6666667f;
        }
        //float num7 = 1f * 1.1f;
        Array.Clear((Array)this.veinVectors, 0, this.veinVectors.Length);
        Array.Clear((Array)this.veinVectorTypes, 0, this.veinVectorTypes.Length);
        //this.veinVectorCount = 0;
        Vector3 vector3_1;

        if (flag1)
        {
            vector3_1 = this.planet.birthPoint;
            vector3_1.Normalize();
            vector3_1 *= 0.75f;
        }
        else
        {
            Vector3 vector3_2;
            vector3_2.x = (float)(random2.NextDouble() * 2.0 - 1.0);
            vector3_2.y = (float)random2.NextDouble() - 0.5f;
            vector3_2.z = (float)(random2.NextDouble() * 2.0 - 1.0);
            vector3_2.Normalize();
            vector3_1 = vector3_2 * (float)(random2.NextDouble() * 0.4 + 0.2);
        }
        this.planet.veinSpotsSketch = numArray1;
        if (sketchOnly)
        {
            return;
        }



        //if (flag1)
        //{
        //    this.veinVectorTypes[0] = EVeinType.Iron;
        //    this.veinVectors[0] = this.planet.birthResourcePoint0;
        //    this.veinVectorTypes[1] = EVeinType.Copper;
        //    this.veinVectors[1] = this.planet.birthResourcePoint1;
        //    this.veinVectorCount = 2;
        //}
        //for (int index1 = 1; index1 < 15 && this.veinVectorCount < this.veinVectors.Length; ++index1)
        //{
        //    EVeinType eveinType = (EVeinType)index1;
        //    int num2 = numArray1[index1];
        //    if (num2 > 1)
        //        num2 += random2.Next(-1, 2);
        //    for (int index2 = 0; index2 < num2; ++index2)
        //    {
        //        int num3 = 0;
        //        Vector3 zero = Vector3.zero;
        //        bool flag3 = false;
        //        while (num3++ < 200)
        //        {
        //            zero.x = (float)(random2.NextDouble() * 2.0 - 1.0);
        //            zero.y = (float)(random2.NextDouble() * 2.0 - 1.0);
        //            zero.z = (float)(random2.NextDouble() * 2.0 - 1.0);
        //            if (eveinType != EVeinType.Oil)
        //                zero += vector3_1;
        //            zero.Normalize();
        //            float num4 = data.QueryHeight(zero);
        //            if ((double)num4 >= (double)this.planet.radius && (eveinType != EVeinType.Oil || (double)num4 >= (double)this.planet.radius + 0.5))
        //            {
        //                bool flag4 = false;
        //                float num5 = eveinType != EVeinType.Oil ? 196f : 100f;
        //                for (int index3 = 0; index3 < this.veinVectorCount; ++index3)
        //                {
        //                    if ((double)(this.veinVectors[index3] - zero).sqrMagnitude < (double)num1 * (double)num1 * (double)num5)
        //                    {
        //                        flag4 = true;
        //                        break;
        //                    }
        //                }
        //                if (!flag4)
        //                {
        //                    flag3 = true;
        //                    break;
        //                }
        //            }
        //        }
        //        if (flag3)
        //        {
        //            this.veinVectors[this.veinVectorCount] = zero;
        //            this.veinVectorTypes[this.veinVectorCount] = eveinType;
        //            ++this.veinVectorCount;
        //            if (this.veinVectorCount == this.veinVectors.Length)
        //                break;
        //        }
        //    }
        //}
        //Array.Clear((Array)this.planet.veinAmounts, 0, this.planet.veinAmounts.Length);
        //data.veinCursor = 1;
        //this.planet.veinGroups = new PlanetData.VeinGroup[this.veinVectorCount];
        //this.tmp_vecs.Clear();
        //VeinData vein = new VeinData();
        //for (int index1 = 0; index1 < this.veinVectorCount; ++index1)
        //{
        //    this.tmp_vecs.Clear();
        //    Vector3 normalized = this.veinVectors[index1].normalized;
        //    EVeinType veinVectorType = this.veinVectorTypes[index1];
        //    int index2 = (int)veinVectorType;
        //    Quaternion rotation = Quaternion.FromToRotation(Vector3.up, normalized);
        //    Vector3 vector3_2 = rotation * Vector3.right;
        //    Vector3 vector3_3 = rotation * Vector3.forward;
        //    this.planet.veinGroups[index1].type = veinVectorType;
        //    this.planet.veinGroups[index1].pos = normalized;
        //    this.planet.veinGroups[index1].count = 0;
        //    this.planet.veinGroups[index1].amount = 0L;
        //    this.tmp_vecs.Add(Vector2.zero);
        //    int num2 = Mathf.RoundToInt(numArray2[index2] * (float)random2.Next(20, 25));
        //    if (veinVectorType == EVeinType.Oil)
        //        num2 = 1;
        //    float num3 = numArray3[index2];
        //    if (flag1 && index1 < 2)
        //    {
        //        num2 = 6;
        //        num3 = 0.2f;
        //    }
        //    int num4 = 0;
        //    while (num4++ < 20)
        //    {
        //        int count = this.tmp_vecs.Count;
        //        for (int index3 = 0; index3 < count && this.tmp_vecs.Count < num2; ++index3)
        //        {
        //            if ((double)this.tmp_vecs[index3].sqrMagnitude <= 36.0)
        //            {
        //                double num5 = random2.NextDouble() * Math.PI * 2.0;
        //                Vector2 vector2_1 = new Vector2((float)Math.Cos(num5), (float)Math.Sin(num5));
        //                vector2_1 += this.tmp_vecs[index3] * 0.2f;
        //                vector2_1.Normalize();
        //                Vector2 vector2_2 = this.tmp_vecs[index3] + vector2_1;
        //                bool flag3 = false;
        //                for (int index4 = 0; index4 < this.tmp_vecs.Count; ++index4)
        //                {
        //                    if ((double)(this.tmp_vecs[index4] - vector2_2).sqrMagnitude < 0.850000023841858)
        //                    {
        //                        flag3 = true;
        //                        break;
        //                    }
        //                }
        //                if (!flag3)
        //                    this.tmp_vecs.Add(vector2_2);
        //            }
        //        }
        //        if (this.tmp_vecs.Count >= num2)
        //            break;
        //    }
        //    int num6 = Mathf.RoundToInt(num3 * 100000f * resourceCoef);
        //    if (num6 < 20)
        //        num6 = 20;
        //    int num8 = num6 >= 16000 ? 15000 : Mathf.FloorToInt((float)num6 * (15f / 16f));
        //    int minValue = num6 - num8;
        //    int maxValue = num6 + num8 + 1;
        //    for (int index3 = 0; index3 < this.tmp_vecs.Count; ++index3)
        //    {
        //        Vector3 vector3_4 = (this.tmp_vecs[index3].x * vector3_2 + this.tmp_vecs[index3].y * vector3_3) * num1;
        //        vein.type = veinVectorType;
        //        vein.groupIndex = (short)index1;
        //        vein.modelIndex = (short)random2.Next(veinModelIndexs[index2], veinModelIndexs[index2] + veinModelCounts[index2]);
        //        vein.amount = Mathf.RoundToInt((float)random2.Next(minValue, maxValue) * num7);
        //        if (this.planet.veinGroups[index1].type != EVeinType.Oil)
        //            vein.amount = Mathf.RoundToInt((float)vein.amount * DSPGame.GameDesc.resourceMultiplier);
        //        if (vein.amount < 1)
        //            vein.amount = 1;
        //        if (flag2 && vein.type != EVeinType.Oil)
        //            vein.amount = 1000000000;
        //        vein.productId = veinProducts[index2];
        //        vein.pos = normalized + vector3_4;
        //        if (vein.type == EVeinType.Oil)
        //            vein.pos = this.planet.aux.RawSnap(vein.pos);
        //        vein.minerCount = 0;
        //        float num5 = data.QueryHeight(vein.pos);
        //        data.EraseVegetableAtPoint(vein.pos);
        //        vein.pos = vein.pos.normalized * num5;
        //        if (this.planet.waterItemId == 0 || (double)num5 >= (double)this.planet.radius)
        //        {
        //            this.planet.veinAmounts[(int)veinVectorType] += (long)vein.amount;
        //            ++this.planet.veinGroups[index1].count;
        //            this.planet.veinGroups[index1].amount += (long)vein.amount;
        //            data.AddVeinData(vein);
        //        }
        //    }
        //}
        this.tmp_vecs.Clear();
        //}
    }
예제 #5
0
    public void SetPlanetTheme(
        PlanetData planet,
        StarData star,
        GameDesc game_desc,
        int set_theme,
        int set_algo,
        double rand1,
        double rand2,
        double rand3,
        double rand4,
        int theme_seed)
    {
        if (set_theme > 0)
        {
            planet.theme = set_theme;
        }
        else
        {
            if (this.tmp_theme == null)
            {
                this.tmp_theme = new List <int>();
            }
            else
            {
                this.tmp_theme.Clear();
            }
            int[] themeIds = game_desc.themeIds;
            int   length   = themeIds.Length;
            for (int index1 = 0; index1 < length; ++index1)
            {
                ThemeProtoSet themes1    = ThemeWorks.GetThemes();
                var           themeProto = themes1.dataArray[index1];
                bool          flag       = false;
                if (planet.star.index == 0 && planet.type == EPlanetType.Ocean)
                {
                    if (themeProto.Distribute == EThemeDistribute.Birth)
                    {
                        flag = true;
                    }
                }
                else if (themeProto.PlanetType == planet.type && (double)themeProto.Temperature * (double)planet.temperatureBias >= -0.100000001490116)
                {
                    if (planet.star.index == 0)
                    {
                        if (themeProto.Distribute == EThemeDistribute.Default)
                        {
                            flag = true;
                        }
                    }
                    else if (themeProto.Distribute != EThemeDistribute.Birth)
                    {
                        flag = true;
                    }
                }
                if (flag)
                {
                    for (int index2 = 0; index2 < planet.index; ++index2)
                    {
                        if (planet.star.planets[index2].theme == themeProto.ID)
                        {
                            flag = false;
                            break;
                        }
                    }
                }
                if (flag)
                {
                    this.tmp_theme.Add(themeProto.ID);
                }
            }
            if (this.tmp_theme.Count == 0)
            {
                for (int index1 = 0; index1 < length; ++index1)
                {
                    ThemeProtoSet themes1    = ThemeWorks.GetThemes();
                    var           themeProto = themes1.dataArray[index1];
                    bool          flag       = false;
                    if (themeProto.PlanetType == EPlanetType.Desert)
                    {
                        flag = true;
                    }
                    if (flag)
                    {
                        for (int index2 = 0; index2 < planet.index; ++index2)
                        {
                            if (planet.star.planets[index2].theme == themeProto.ID)
                            {
                                flag = false;
                                break;
                            }
                        }
                    }
                    if (flag)
                    {
                        this.tmp_theme.Add(themeProto.ID);
                    }
                }
            }
            if (this.tmp_theme.Count == 0)
            {
                for (int index = 0; index < length; ++index)
                {
                    ThemeProtoSet themes1    = ThemeWorks.GetThemes();
                    var           themeProto = themes1.dataArray[index];
                    if (themeProto.PlanetType == EPlanetType.Desert)
                    {
                        this.tmp_theme.Add(themeProto.ID);
                    }
                }
            }
            planet.theme = this.tmp_theme[(int)(rand1 * (double)this.tmp_theme.Count) % this.tmp_theme.Count];
        }

        ThemeProtoSet themes      = ThemeWorks.GetThemes();
        var           themeProto1 = themes.dataArray[planet.theme - 1];

        if (set_algo > 0)
        {
            planet.algoId = set_algo;
        }
        else
        {
            planet.algoId = 0;
            if (themeProto1 != null && themeProto1.Algos != null && 1 > 0)
            {
                planet.algoId = themeProto1.Algos.@int;
                //planet.algoId = themeProto1.Algos[(int)(rand2 * (double)themeProto1.Algos.Length) % themeProto1.Algos.Length];
                planet.mod_x = (double)themeProto1.ModX.x + rand3 * ((double)themeProto1.ModX.y - (double)themeProto1.ModX.x);
                planet.mod_y = (double)themeProto1.ModY.x + rand4 * ((double)themeProto1.ModY.y - (double)themeProto1.ModY.x);
            }
        }
        if (themeProto1 == null)
        {
            return;
        }
        planet.type         = themeProto1.PlanetType;
        planet.ionHeight    = themeProto1.IonHeight;
        planet.windStrength = themeProto1.Wind;
        planet.waterHeight  = themeProto1.WaterHeight;
        planet.waterItemId  = themeProto1.WaterItemId;
        planet.levelized    = themeProto1.UseHeightForBuild;
        if (planet.type != EPlanetType.Gas)
        {
            return;
        }
        int length1 = themeProto1.GasItems.Length;
        int length2 = themeProto1.GasSpeeds.Length;

        int[]   numArray1 = new int[length1];
        float[] numArray2 = new float[length2];
        float[] numArray3 = new float[length1];
        for (int index = 0; index < length1; ++index)
        {
            numArray1[index] = themeProto1.GasItems[index];
        }
        double num1   = 0.0;
        Random random = new Random(theme_seed);

        for (int index = 0; index < length2; ++index)
        {
            float num2 = themeProto1.GasSpeeds[index] * (float)(random.NextDouble() * 0.190909147262573 + 0.909090876579285);
            numArray2[index] = num2 * Mathf.Pow(star.resourceCoef, 0.3f);
            //ItemProto itemProto = LDB.items.Select(numArray1[index]);
            //numArray3[index] = (float)itemProto.HeatValue;
            //num1 += (double)numArray3[index] * (double)numArray2[index];
        }
        //planet.gasItems = numArray1;
        planet.gasSpeeds = numArray2;
        //planet.gasHeatValues = numArray3;
        planet.gasTotalHeat = num1;
    }