Exemplo n.º 1
0
        private void Generate(ulong SystemParam_0, ulong SystemParam_1)
        {
            this._generated = true;
            this._z         = (((int)((SystemParam_0 & 0xFFFF0000) >> 16) & 0x3FF) - 0x1FF) << 1;
            this._y         = ((int)(SystemParam_0 >> 8) & 0x7F) - 0x3F;
            this._x         = ((int)((SystemParam_0 & 0x0001FE) >> 1) & 0x7F) - 0x3F;
            this._multiple  = (byte)StarChance_Multiples[SystemParam_1 & 0x1f];

            //sth += (ulong)this._sector.SectorColor.R;
            //sth += (ulong)this._sector.SectorColor.G;
            //sth += (ulong)this._sector.SectorColor.B;
            //sth /= 3;

            this._ageClass =
                (StarAgeClass)(AgeChance[(int)((SystemParam_0 >> 2) & 0x1F)]);

            this._mainSequenceSpectralClass =
                (StarSpectralClass)(BaseSpectralClassChance[(int)((((SystemParam_0 >> 4) & 0x1F)) & 0x1F)]);

            this._spectralClass = (StarSpectralClass)AgeSpectralEvolution
                                  [(int)_mainSequenceSpectralClass]
                                  [(int)_ageClass];

            this._luminosityClass = (StarLuminosityClass)AgeLuminosityEvolution
                                    [(int)_mainSequenceSpectralClass]
                                    [(int)_ageClass];

            this._mass = StarMass
                         [(int)_mainSequenceSpectralClass]
                         [(int)_luminosityClass];

            this._magnitude = StarMagnitude[(int)_spectralClass][(int)_luminosityClass];
            this._hZone     = StarHz[(int)_spectralClass][(int)_luminosityClass];

            //this._luminosityClass = (StarLuminosityClass)(LChance[(int)((SystemParam_1 >> 2) & 0x1F | sth)]);
            //this._spectralClass = (StarSpectralClass) SvsLChance[(int)this._luminosityClass & 0x1F][(SystemParam_1 >> 4) & 0x1F];

            this._starType = string.Format("{0}{1}{2}",
                                           _spectralClass,
                                           _magnitude,
                                           _luminosityClass);



            if ((int)this._luminosityClass <= 4)
            {
                this.Name = GetCommonName_A(Sector.IndexX, Sector.IndexY, _sysNum, true);
            }
            else if ((int)this._luminosityClass < 6)
            {
                this.Name = GetCommonName_A(Sector.IndexX, Sector.IndexY, _sysNum, false);
            }
            else
            {
                this.Name = GetSystemName_C(Sector.IndexX, Sector.IndexY, _sysNum);
            }


            this._commonName = this.Name;             //GetCommonName_A(Sector.IndexX, Sector.IndexY, _sysNum);
        }
Exemplo n.º 2
0
        public StarSystem(Sector sector, int sysNum, string typeCode, string name, int sX, int sY, int sZ)
            : base(sector, sector.Coords)
        {
            string[] mTypeCode = typeCode.Split('+');

            this._generated = false;
            this._multiple  = (byte)mTypeCode.Length;
            this.Name       = name;
            this._sysNum    = sysNum;
            this._x         = sX;
            this._y         = sY;
            this._systemId  = (((ulong)sysNum) << 26) + (((ulong)sector.IndexX) << 13) + (ulong)sector.IndexY;
            this.Sector     = sector;

            //if (sZ > 128 || sZ < -128)
            //    this._z = 128 * Math.Sign(sZ);
            //else
            this._z = sZ;

            Match m = Regex.Match(mTypeCode[0], "[IVXab]+");

            if (m.Success)
            {
                string value  = m.Groups[0].Value;
                char   stChar = mTypeCode[0][0];

                for (int i = 0; i < StarTypeChar.Length; i++)
                {
                    if (stChar == StarTypeChar[i])
                    {
                        for (int j = 0; j < StarLuminosity.Length; j++)
                        {
                            if (value == StarLuminosity[j])
                            {
                                this._type                      = (byte)TypeTable[j][i];
                                this._luminosityClass           = (StarLuminosityClass)j;
                                this._spectralClass             = (StarSpectralClass)i;
                                this._mainSequenceSpectralClass = (StarSpectralClass)i;

                                this._magnitude = (int)Math.Round(float.Parse(
                                                                      Regex.Replace(mTypeCode[0], "[A-Za-z\\-]+", ""),
                                                                      System.Globalization.CultureInfo.InvariantCulture
                                                                      ), 0);

                                this._starType = string.Format("{0}{1}{2}",
                                                               _spectralClass,
                                                               _magnitude,
                                                               _luminosityClass);
                                break;
                            }
                        }
                        break;
                    }
                }
            }
            BuildCoords();

            if (name != "Sol")
            {
                CalculateNumOfBodies();
            }
            else
            {
                _numOfBodies = 9;
            }

            //Sector solSector = new Sector();

            //double distance = this.Coords.CalculateDistance(solSector.Coords);

            //if (distance > 100) {

            //    _utils = new StarSystemUtils(this);

            //    StarSystemUtils.PlanSys sysInfo = new StarSystemUtils.PlanSys();
            //    sysInfo.Population = (uint)(12 << 3);
            //    sysInfo.descOverride = "System explored. No registered settlements.";
            //    sysInfo.economy = 8;
            //    sysInfo.govType = 8;
            //    sysInfo.techLevel = 0;
            //    sysInfo.Productivity = 0;

            //    _utils.Information = sysInfo;

            //} else if (distance > 150) {

            //    _utils = new StarSystemUtils(this);

            //    StarSystemUtils.PlanSys sysInfo = new StarSystemUtils.PlanSys();
            //    sysInfo.Population = (uint)(12 << 3);
            //    sysInfo.descOverride = "System unexplored.";
            //    sysInfo.economy = 8;
            //    sysInfo.govType = 8;
            //    sysInfo.techLevel = 0;
            //    sysInfo.Productivity = 0;

            //    _utils.Information = sysInfo;
            //}

            this._mass = StarMass
                         [(int)_mainSequenceSpectralClass]
                         [(int)_luminosityClass];

            if (_generated)
            {
                this._magnitude = StarMagnitude[(int)_spectralClass][(int)_luminosityClass];
            }

            this._hZone = StarHz[(int)_spectralClass][(int)_luminosityClass];
        }