Exemplo n.º 1
0
        async private void DrawSystem(ISystem sys, string tt = null)
        {
            if (tt != null)
            {
                titletext = tt;
                SetControlText(tt);
            }

            pictureBoxSurveyor.ClearImageList();

            // if system, and we are in no focus or don't care
            if (sys != null && (uistate == EliteDangerousCore.UIEvents.UIGUIFocus.Focus.NoFocus || !autoHideToolStripMenuItem.Checked ||
                                (uistate == EliteDangerousCore.UIEvents.UIGUIFocus.Focus.FSSMode && dontHideInFSSModeToolStripMenuItem.Checked)))
            {
                int          vpos = 0;
                StringFormat frmt = new StringFormat(wordWrapToolStripMenuItem.Checked ? 0: StringFormatFlags.NoWrap);
                frmt.Alignment = alignment;
                var textcolour = IsTransparent ? discoveryform.theme.SPanelColor : discoveryform.theme.LabelColor;
                var backcolour = IsTransparent ? Color.Transparent : this.BackColor;

                if (!IsControlTextVisible() && showSystemInfoOnScreenWhenInTransparentModeToolStripMenuItem.Checked)
                {
                    var i = pictureBoxSurveyor.AddTextAutoSize(
                        new Point(3, vpos),
                        new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 10000),
                        titletext,
                        Font,
                        textcolour,
                        backcolour,
                        1.0F,
                        frmt: frmt);

                    vpos += i.Location.Height;
                }

                StarScan.SystemNode systemnode = await discoveryform.history.StarScan.FindSystemAsync(sys, checkEDSMForInformationToolStripMenuItem.Checked); // get data with EDSM

                if (systemnode != null)                                                                                                                       // no data, clear display, clear any last_he so samesys is false next time
                {
                    string infoline = "";

                    int scanned = systemnode.StarPlanetsScanned();

                    if (scanned > 0)
                    {
                        infoline = "Scan".T(EDTx.UserControlSurveyor_Scan) + " " + scanned.ToString() + (systemnode.FSSTotalBodies != null ? (" / " + systemnode.FSSTotalBodies.Value.ToString()) : "");
                    }

                    long value = systemnode.ScanValue(false);

                    if (value > 0 && showValuesToolStripMenuItem.Checked)
                    {
                        infoline = infoline.AppendPrePad("~ " + value.ToString("N0") + " cr", "; ");
                    }

                    if (infoline.HasChars())
                    {
                        //System.Diagnostics.Debug.WriteLine("Draw " + infoline);
                        var i = pictureBoxSurveyor.AddTextAutoSize(
                            new Point(3, vpos),
                            new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 10000),
                            infoline,
                            Font,
                            textcolour,
                            backcolour,
                            1.0F,
                            frmt: frmt);
                        vpos += i.Location.Height;
                    }

                    var all_nodes = systemnode.Bodies.ToList();

                    if (all_nodes != null)
                    {
                        value = 0;

                        foreach (StarScan.ScanNode sn in all_nodes)
                        {
                            if (sn.ScanData != null && sn.ScanData?.BodyName != null && (!sn.ScanData.IsEDSMBody || checkEDSMForInformationToolStripMenuItem.Checked))
                            {
                                var sd = sn.ScanData;

                                if (
                                    (sd.IsLandable && landableToolStripMenuItem.Checked) ||
                                    (sd.IsLandable && sd.HasAtmosphericComposition && landableWithAtmosphereToolStripMenuItem.Checked) ||
                                    (sd.IsLandable && sd.HasMeaningfulVolcanism && landableWithVolcanismToolStripMenuItem.Checked) ||
                                    (sd.IsLandable && sd.nRadius.HasValue && sd.nRadius >= largeRadiusLimit && landableAndLargeToolStripMenuItem.Checked) ||
                                    (sd.AmmoniaWorld && ammoniaWorldToolStripMenuItem.Checked) ||
                                    (sd.Earthlike && earthlikeWorldToolStripMenuItem.Checked) ||
                                    (sd.WaterWorld && waterWorldToolStripMenuItem.Checked) ||
                                    (sd.PlanetTypeID == EDPlanet.High_metal_content_body && highMetalContentBodyToolStripMenuItem.Checked) ||
                                    (sd.PlanetTypeID == EDPlanet.Metal_rich_body && metalToolStripMenuItem.Checked) ||
                                    (sd.HasRings && hasRingsToolStripMenuItem.Checked) ||
                                    (sd.HasMeaningfulVolcanism && hasVolcanismToolStripMenuItem.Checked) ||
                                    (sd.nEccentricity.HasValue && sd.nEccentricity >= eccentricityLimit && highEccentricityToolStripMenuItem.Checked) ||
                                    (sd.CanBeTerraformable && terraformableToolStripMenuItem.Checked) ||
                                    (sd.IsPlanet && lowRadiusToolStripMenuItem.Checked && sd.nRadius.HasValue && sd.nRadius < lowRadiusLimit) ||
                                    (sn.Signals != null && hasSignalsToolStripMenuItem.Checked) ||
                                    (sd.IsStar && showAllStarsToolStripMenuItem.Checked) ||
                                    (sd.IsPlanet && showAllPlanetsToolStripMenuItem.Checked) ||
                                    (sd.IsBeltCluster && showBeltClustersToolStripMenuItem.Checked))
                                {
                                    if (!sd.Mapped || hideAlreadyMappedBodiesToolStripMenuItem.Checked == false)      // if not mapped, or show mapped
                                    {
                                        var il = sd.SurveyorInfoLine(sys,
                                                                     sn.Signals != null,                                        // show signals if we have some
                                                                     hasVolcanismToolStripMenuItem.Checked || (sd.IsLandable && landableWithVolcanismToolStripMenuItem.Checked) ||
                                                                     (sd.IsLandable && showVolcanismToolStripMenuItem.Checked), // any of these makes us need to show volcanic state
                                                                     showValuesToolStripMenuItem.Checked,                       // show values
                                                                     showMoreInformationToolStripMenuItem.Checked,              // show extra info such as mass/radius
                                                                     showGravityToolStripMenuItem.Checked,                      // show gravity select
                                                                     sd.IsLandable && showAtmosToolStripMenuItem.Checked,       // show atmosphere if landable (surveyor shows this if landable)
                                                                     hasRingsToolStripMenuItem.Checked,                         // show rings
                                                                     lowRadiusLimit, largeRadiusLimit, eccentricityLimit);

                                        //System.Diagnostics.Debug.WriteLine("Display " + il);
                                        var i = pictureBoxSurveyor.AddTextAutoSize(
                                            new Point(3, vpos),
                                            new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 10000),
                                            il,
                                            Font,
                                            textcolour,
                                            backcolour,
                                            1.0F,
                                            frmt: frmt);
                                        vpos  += i.Location.Height;
                                        value += sd.EstimatedValue;
                                    }
                                }
                            }
                        }

                        if (value > 0 && showValuesToolStripMenuItem.Checked)
                        {
                            var i = pictureBoxSurveyor.AddTextAutoSize(
                                new Point(3, vpos),
                                new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 10000),
                                "^^ ~ " + value.ToString("N0") + " cr",
                                Font,
                                textcolour,
                                backcolour,
                                1.0F,
                                frmt: frmt);
                            vpos += i.Location.Height;
                        }
                    }

                    if (fsssignalsdisplayed.HasChars())
                    {
                        string   siglist = "";
                        string[] filter  = fsssignalsdisplayed.Split(';');

                        // mirrors scandisplaynodes

                        var notexpired = systemnode.FSSSignalList.Where(x => !x.TimeRemaining.HasValue || x.ExpiryUTC >= DateTime.UtcNow).ToList();
                        notexpired.Sort(delegate(JournalFSSSignalDiscovered.FSSSignal l, JournalFSSSignalDiscovered.FSSSignal r) { return(l.ClassOfSignal.CompareTo(r.ClassOfSignal)); });

                        var expired = systemnode.FSSSignalList.Where(x => x.TimeRemaining.HasValue && x.ExpiryUTC < DateTime.UtcNow).ToList();
                        expired.Sort(delegate(JournalFSSSignalDiscovered.FSSSignal l, JournalFSSSignalDiscovered.FSSSignal r) { return(r.ExpiryUTC.CompareTo(l.ExpiryUTC)); });

                        int expiredpos = notexpired.Count;
                        notexpired.AddRange(expired);

                        int pos = 0;
                        foreach (var fsssig in notexpired)
                        {
                            if (filter.ComparisionContains(fsssig.SignalName.Alt("!~~"), StringComparison.InvariantCultureIgnoreCase) >= 0 ||
                                filter.ComparisionContains(fsssig.SignalName_Localised.Alt("!~~"), StringComparison.InvariantCultureIgnoreCase) >= 0 ||
                                filter.ComparisionContains(fsssig.SpawningState_Localised.Alt("!~~"), StringComparison.InvariantCultureIgnoreCase) >= 0 ||
                                filter.ComparisionContains(fsssig.SpawningFaction_Localised.Alt("!~~"), StringComparison.InvariantCultureIgnoreCase) >= 0 ||
                                filter.ComparisionContains(fsssig.USSTypeLocalised.Alt("!~~"), StringComparison.InvariantCultureIgnoreCase) >= 0 ||
                                filter.ComparisionContains(fsssig.ClassOfSignal.ToString(), StringComparison.InvariantCultureIgnoreCase) >= 0 ||
                                fsssignalsdisplayed.Equals("*"))
                            {
                                if (pos++ == expiredpos)
                                {
                                    siglist = siglist.AppendPrePad("Expired:".T(EDTx.UserControlScan_Expired), Environment.NewLine + Environment.NewLine);
                                }

                                siglist = siglist.AppendPrePad(fsssig.ToString(true), Environment.NewLine);
                            }
                        }

                        if (siglist.HasChars())
                        {
                            //System.Diagnostics.Debug.WriteLine("Display " + siglist);
                            pictureBoxSurveyor.AddTextAutoSize(new Point(3, vpos),
                                                               new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 10000),
                                                               siglist,
                                                               Font,
                                                               textcolour,
                                                               backcolour,
                                                               1.0F,
                                                               frmt: frmt);
                        }
                    }
                }
            }

            extPictureBoxScroll.Render();
        }
Exemplo n.º 2
0
        private void UpdateSystemRow(int rowindex)
        {
            const int idxVisits = 5;
            const int idxScans  = 6;
            const int idxBodies = 7;
            const int idxstars  = 8;
            const int idxInfo   = 9;
            const int idxNote   = 10;

            ISystem currentSystem = discoveryform.history.CurrentSystem; // may be null

            if (rowindex < dataGridViewExplore.Rows.Count && dataGridViewExplore[0, rowindex].Value != null)
            {
                string  sysname = dataGridViewExplore[0, rowindex].Value.ToString();
                ISystem sys     = (ISystem)dataGridViewExplore[0, rowindex].Tag;

                if (sys == null)
                {
                    sys = discoveryform.history.FindSystem(sysname);
                }

                if (sys != null && currentSystem != null)
                {
                    double dist    = sys.Distance(currentSystem);
                    string strdist = dist >= 0 ? ((double)dist).ToString("0.00") : "";
                    dataGridViewExplore[1, rowindex].Value = strdist;
                }

                dataGridViewExplore[0, rowindex].Tag = sys;
                dataGridViewExplore.Rows[rowindex].DefaultCellStyle.ForeColor = (sys != null && sys.HasCoordinate) ? discoveryform.theme.VisitedSystemColor : discoveryform.theme.NonVisitedSystemColor;

                if (sys != null)
                {
                    if (sys.HasCoordinate)
                    {
                        dataGridViewExplore[2, rowindex].Value = sys.X.ToString("0.00");
                        dataGridViewExplore[3, rowindex].Value = sys.Y.ToString("0.00");
                        dataGridViewExplore[4, rowindex].Value = sys.Z.ToString("0.00");
                    }

                    dataGridViewExplore[idxVisits, rowindex].Value = discoveryform.history.GetVisitsCount(sysname).ToString();

                    StarScan.SystemNode sysnode = discoveryform.history.starscan.FindSystem(sys, false);

                    if (sysnode != null)
                    {
                        dataGridViewExplore[idxScans, rowindex].Value = sysnode.StarPlanetsScanned().ToString();
                        if (sysnode.FSSTotalBodies.HasValue)
                        {
                            dataGridViewExplore[idxBodies, rowindex].Value = sysnode.FSSTotalBodies.Value.ToString();
                        }

                        dataGridViewExplore[idxstars, rowindex].Value = sysnode.StarTypesFound(false);

                        string info = "";
                        foreach (var scan in sysnode.Bodies)
                        {
                            JournalScan sd = scan.ScanData;
                            if (sd != null)
                            {
                                if (sd.IsStar)
                                {
                                    if (sd.StarTypeID == EDStar.AeBe)
                                    {
                                        info = info + " " + "AeBe";
                                    }
                                    if (sd.StarTypeID == EDStar.N)
                                    {
                                        info = info + " " + "NS";
                                    }
                                    if (sd.StarTypeID == EDStar.H)
                                    {
                                        info = info + " " + "BH";
                                    }
                                }
                                else
                                {
                                    if (sd.PlanetTypeID == EDPlanet.Earthlike_body)
                                    {
                                        info = info + " " + (sd.Terraformable ? "T-ELW" : "ELW");
                                    }
                                    else if (sd.PlanetTypeID == EDPlanet.Water_world)
                                    {
                                        info = info + " " + (sd.Terraformable ? "T-WW" : "WW");
                                    }
                                    else if (sd.PlanetTypeID == EDPlanet.High_metal_content_body && sd.Terraformable)
                                    {
                                        info = info + " " + "T-HMC";
                                    }
                                }
                            }
                        }

                        dataGridViewExplore[idxInfo, rowindex].Value = info.Trim();
                    }

                    string          note = "";
                    SystemNoteClass sn   = SystemNoteClass.GetNoteOnSystem(sys.Name, sys.EDSMID);
                    if (sn != null && !string.IsNullOrWhiteSpace(sn.Note))
                    {
                        note = sn.Note;
                    }
                    else
                    {
                        BookmarkClass bkmark = GlobalBookMarkList.Instance.FindBookmarkOnSystem(sys.Name);
                        if (bkmark != null && !string.IsNullOrWhiteSpace(bkmark.Note))
                        {
                            note = bkmark.Note;
                        }
                        else
                        {
                            var gmo = discoveryform.galacticMapping.Find(sys.Name);
                            if (gmo != null && !string.IsNullOrWhiteSpace(gmo.description))
                            {
                                note = gmo.description;
                            }
                        }
                    }
                    dataGridViewExplore[idxNote, rowindex].Value = note.WordWrap(60);
                }

                if (sys == null && sysname != "")
                {
                    dataGridViewExplore.Rows[rowindex].ErrorText = "System not known".T(EDTx.Systemnotknown);
                }
                else
                {
                    dataGridViewExplore.Rows[rowindex].ErrorText = "";
                }
            }
        }
Exemplo n.º 3
0
        async private void DrawSystem(ISystem sys, string tt = null)
        {
            if (tt != null)
            {
                titletext = tt;
                SetControlText(tt);
            }

            pictureBoxSurveyor.ClearImageList();

            // if system, and we are in no focus or don't care
            if (sys != null && (uistate == EliteDangerousCore.UIEvents.UIGUIFocus.Focus.NoFocus || !autoHideToolStripMenuItem.Checked ||
                                (uistate == EliteDangerousCore.UIEvents.UIGUIFocus.Focus.FSSMode && dontHideInFSSModeToolStripMenuItem.Checked)))
            {
                int          vpos = 0;
                StringFormat frmt = new StringFormat(wordWrapToolStripMenuItem.Checked ? 0: StringFormatFlags.NoWrap);
                frmt.Alignment = alignment;
                var textcolour = IsTransparent ? discoveryform.theme.SPanelColor : discoveryform.theme.LabelColor;
                var backcolour = IsTransparent ? Color.Transparent : this.BackColor;

                if (!IsControlTextVisible() && showSystemInfoOnScreenWhenInTransparentModeToolStripMenuItem.Checked)
                {
                    var i = pictureBoxSurveyor.AddTextAutoSize(
                        new Point(3, vpos),
                        new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 1000),
                        titletext,
                        Font,
                        textcolour,
                        backcolour,
                        1.0F,
                        frmt: frmt);

                    vpos += i.Location.Height;
                }

                StarScan.SystemNode systemnode = await discoveryform.history.starscan.FindSystemAsync(sys, checkEDSMForInformationToolStripMenuItem.Checked); // get data with EDSM

                if (systemnode != null)                                                                                                                       // no data, clear display, clear any last_he so samesys is false next time
                {
                    string infoline = "";

                    int scanned = systemnode.StarPlanetsScanned();

                    if (scanned > 0)
                    {
                        infoline = "Scan".T(EDTx.UserControlSurveyor_Scan) + " " + scanned.ToString() + (systemnode.FSSTotalBodies != null ? (" / " + systemnode.FSSTotalBodies.Value.ToString()) : "");
                    }

                    long value = systemnode.ScanValue(false);

                    if (value > 0 && showValuesToolStripMenuItem.Checked)
                    {
                        infoline = infoline.AppendPrePad("~ " + value.ToString("N0") + " cr", "; ");
                    }

                    if (infoline.HasChars())
                    {
                        var i = pictureBoxSurveyor.AddTextAutoSize(
                            new Point(3, vpos),
                            new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 1000),
                            infoline,
                            Font,
                            textcolour,
                            backcolour,
                            1.0F,
                            frmt: frmt);
                        vpos += i.Location.Height;
                    }

                    var all_nodes = systemnode.Bodies.ToList();

                    if (all_nodes != null)
                    {
                        value = 0;

                        foreach (StarScan.ScanNode sn in all_nodes)
                        {
                            if (sn.ScanData != null && sn.ScanData?.BodyName != null)
                            {
                                var sd = sn.ScanData;

                                if (
                                    (sd.IsLandable && landableToolStripMenuItem.Checked) ||
                                    (sd.AmmoniaWorld && ammoniaWorldToolStripMenuItem.Checked) ||
                                    (sd.Earthlike && earthlikeWorldToolStripMenuItem.Checked) ||
                                    (sd.WaterWorld && waterWorldToolStripMenuItem.Checked) ||
                                    (sd.HasRings && !sd.AmmoniaWorld && !sd.Earthlike && !sd.WaterWorld && hasRingsToolStripMenuItem.Checked) ||
                                    (sd.HasMeaningfulVolcanism && hasVolcanismToolStripMenuItem.Checked) ||
                                    (sd.Terraformable && terraformableToolStripMenuItem.Checked) ||
                                    (lowRadiusToolStripMenuItem.Checked && sd.nRadius.HasValue && sd.nRadius < lowRadiusLimit) ||
                                    (sn.Signals != null && hasSignalsToolStripMenuItem.Checked) ||
                                    (sd.IsStar && showAllStarsToolStripMenuItem.Checked) ||
                                    (sd.IsPlanet && showAllPlanetsToolStripMenuItem.Checked) ||
                                    (sd.IsBeltCluster && showBeltClustersToolStripMenuItem.Checked))
                                {
                                    if (!sd.Mapped || hideAlreadyMappedBodiesToolStripMenuItem.Checked == false)      // if not mapped, or show mapped
                                    {
                                        var i = pictureBoxSurveyor.AddTextAutoSize(
                                            new Point(3, vpos),
                                            new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 1000),
                                            InfoLine(last_sys, sn, sd),
                                            Font,
                                            textcolour,
                                            backcolour,
                                            1.0F,
                                            frmt: frmt);

                                        vpos  += i.Location.Height;
                                        value += sd.EstimatedValue;
                                    }
                                }
                            }
                        }

                        if (value > 0 && showValuesToolStripMenuItem.Checked)
                        {
                            var i = pictureBoxSurveyor.AddTextAutoSize(
                                new Point(3, vpos),
                                new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 1000),
                                "^^ ~ " + value.ToString("N0") + " cr",
                                Font,
                                textcolour,
                                backcolour,
                                1.0F,
                                frmt: frmt);
                            vpos += i.Location.Height;
                        }
                    }
                }
            }

            pictureBoxSurveyor.Render();
        }
Exemplo n.º 4
0
        string Infoline(List <HistoryEntry> syslist, StarScan.SystemNode sysnode)
        {
            string infostr      = "";
            string jumponium    = "";
            bool   hasMaterials = false;

            if (syslist.Count > 1)
            {
                infostr = string.Format("First visit {0}".T(EDTx.UserControlStarList_FV), EDDConfig.Instance.ConvertTimeToSelectedFromUTC(syslist.Last().EventTimeUTC).ToShortDateString());
            }

            #region information

            if (sysnode != null)
            {
                if (sysnode.starnodes != null)
                {
                    string st = sysnode.StarTypesFound();
                    if (st.HasChars())
                    {
                        st = " " + st;
                    }
                    int stars = sysnode.StarsScanned();
                    infostr = infostr.AppendPrePad(string.Format("{0} Star(s){1}".T(EDTx.UserControlStarList_CS), stars, st), Environment.NewLine);

                    string extrainfo = "";
                    string prefix    = Environment.NewLine;
                    string noprefix  = "";

                    foreach (StarScan.ScanNode sn in sysnode.Bodies)
                    {
                        string bodyinfo = "";
                        if (sn.ScanData != null && checkBoxBodyClasses.Checked)
                        {
                            JournalScan sc            = sn.ScanData;
                            string      bodynameshort = sc.BodyName.ReplaceIfStartsWith(syslist[0].System.Name);

                            if (sc.IsStar) // brief notification for special or uncommon celestial bodies, useful to traverse the history and search for that special body you discovered.
                            {
                                // Sagittarius A* is a special body: is the centre of the Milky Way, and the only one which is classified as a Super Massive Black Hole. As far as we know...
                                if (sc.StarTypeID == EDStar.SuperMassiveBlackHole)
                                {
                                    bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is a super massive black hole".T(EDTx.UserControlStarList_SMBH), sc.BodyName), prefix);
                                }

                                // black holes
                                if (sc.StarTypeID == EDStar.H)
                                {
                                    bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is a black hole".T(EDTx.UserControlStarList_BH), sc.BodyName), prefix);
                                }

                                // neutron stars
                                if (sc.StarTypeID == EDStar.N)
                                {
                                    bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is a neutron star".T(EDTx.UserControlStarList_NS), sc.BodyName), prefix);
                                }

                                // white dwarf (D, DA, DAB, DAO, DAZ, DAV, DB, DBZ, DBV, DO, DOV, DQ, DC, DCV, DX)
                                string WhiteDwarf = "White Dwarf";
                                if (sc.StarTypeText.Contains(WhiteDwarf))
                                {
                                    bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is a {1} white dwarf star".T(EDTx.UserControlStarList_WD), sc.BodyName, sc.StarTypeID), prefix);
                                }

                                // wolf rayet (W, WN, WNC, WC, WO)
                                string WolfRayet = "Wolf-Rayet";
                                if (sc.StarTypeText.Contains(WolfRayet))
                                {
                                    bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is a {1} wolf-rayet star".T(EDTx.UserControlStarList_WR), sc.BodyName, sc.StarTypeID), prefix);
                                }

                                // giants. It should recognize all classes of giants.
                                if (sc.StarTypeText.Contains("Giant"))
                                {
                                    bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is a {1}".T(EDTx.UserControlStarList_OTHER), sc.BodyName, sc.StarTypeText), prefix);
                                }

                                // rogue planets - not sure if they really exists, but they are in the journal, so...
                                if (sc.StarTypeID == EDStar.RoguePlanet)
                                {
                                    bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is a rogue planet".T(EDTx.UserControlStarList_RP), sc.BodyName), prefix);
                                }
                            }

                            else

                            {
                                // Check if a non-star body is a moon or not. We want it to further refine our brief summary in the visited star list.
                                // To avoid duplicates, we need to apply our filters before on the bodies recognized as a moon, than do the same for the other bodies that do not fulfill that criteria.

                                if (sn.level >= 2 && sn.type == StarScan.ScanNodeType.body)

                                // Tell us that that special body is a moon. After all, it can be quite an outstanding discovery...
                                {
                                    // Earth-like moon
                                    if (sc.PlanetTypeID == EDPlanet.Earthlike_body)
                                    {
                                        bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is an earth like moon".T(EDTx.UserControlStarList_ELM), bodynameshort), prefix);
                                    }

                                    // Terraformable water moon
                                    if (sc.Terraformable == true && sc.PlanetTypeID == EDPlanet.Water_world)
                                    {
                                        bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is a terraformable water moon".T(EDTx.UserControlStarList_TWM), bodynameshort), prefix);
                                    }
                                    // Water moon
                                    if (sc.Terraformable == false && sc.PlanetTypeID == EDPlanet.Water_world)
                                    {
                                        bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is a water moon".T(EDTx.UserControlStarList_WM), bodynameshort), prefix);
                                    }

                                    // Terraformable moon
                                    if (sc.Terraformable == true && sc.PlanetTypeID != EDPlanet.Water_world)
                                    {
                                        bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is a terraformable moon".T(EDTx.UserControlStarList_TM), bodynameshort), prefix);
                                    }

                                    // Ammonia moon
                                    if (sc.PlanetTypeID == EDPlanet.Ammonia_world)
                                    {
                                        bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is an ammonia moon".T(EDTx.UserControlStarList_AM), bodynameshort), prefix);
                                    }
                                }

                                else

                                // Do the same, for all planets
                                {
                                    // Earth Like planet
                                    if (sc.PlanetTypeID == EDPlanet.Earthlike_body)
                                    {
                                        bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is an earth like planet".T(EDTx.UserControlStarList_ELP), bodynameshort), prefix);
                                    }

                                    // Terraformable water world
                                    if (sc.PlanetTypeID == EDPlanet.Water_world && sc.Terraformable == true)
                                    {
                                        bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is a terraformable water world".T(EDTx.UserControlStarList_TWW), bodynameshort), prefix);
                                    }
                                    // Water world
                                    if (sc.PlanetTypeID == EDPlanet.Water_world && sc.Terraformable == false)
                                    {
                                        bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is a water world".T(EDTx.UserControlStarList_WW), bodynameshort), prefix);
                                    }

                                    // Terraformable planet
                                    if (sc.Terraformable == true && sc.PlanetTypeID != EDPlanet.Water_world)
                                    {
                                        bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is a terraformable planet".T(EDTx.UserControlStarList_TP), bodynameshort), prefix);
                                    }

                                    // Ammonia world
                                    if (sc.PlanetTypeID == EDPlanet.Ammonia_world)
                                    {
                                        bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} is an ammonia world".T(EDTx.UserControlStarList_AW), bodynameshort), prefix);
                                    }
                                }

                                if (sn.Signals != null)
                                {
                                    bodyinfo = bodyinfo.AppendPrePad(string.Format("{0} has signals".T(EDTx.UserControlStarList_Signals), bodynameshort), prefix);
                                }

                                //Add Distance - Remember no newline
                                if (bodyinfo != "")
                                {
                                    double distance = sc.DistanceFromArrivalLS;
                                    bodyinfo  = bodyinfo.AppendPrePad(string.Format(" ({0} ls)".T(EDTx.UserControlStarList_Distance), distance.ToString("n0")), noprefix);
                                    extrainfo = extrainfo.AppendPrePad(bodyinfo, prefix);
                                }
                            }
                        }

                        // Landable bodies with valuable materials
                        if (sn.ScanData != null && sn.ScanData.IsLandable == true && sn.ScanData.HasMaterials && checkBoxJumponium.Checked == true)
                        {
                            hasMaterials = true;

                            int basic    = 0;
                            int standard = 0;
                            int premium  = 0;

                            foreach (KeyValuePair <string, double> mat in sn.ScanData.Materials)
                            {
                                string usedin = Recipes.UsedInSythesisByFDName(mat.Key);
                                if (usedin.Contains("FSD-Basic"))
                                {
                                    basic++;
                                }
                                if (usedin.Contains("FSD-Standard"))
                                {
                                    standard++;
                                }
                                if (usedin.Contains("FSD-Premium"))
                                {
                                    premium++;
                                }
                            }

                            // string MaterialsBrief = sn.ScanData.DisplayMaterials(4).ToString();
                            //System.Diagnostics.Debug.WriteLine("{0} {1} {2} {3} {4}", sn.fullname , basic, standard, premium, MaterialsBrief);

                            if (basic > 0 || standard > 0 || premium > 0)
                            {
                                int mats = basic + standard + premium;

                                StringBuilder jumpLevel = new StringBuilder();

                                if (basic != 0)
                                {
                                    jumpLevel.AppendPrePad(basic + "/" + Recipes.FindSynthesis("FSD", "Basic").Count + " Basic".T(EDTx.UserControlStarList_BFSD), ", ");
                                }
                                if (standard != 0)
                                {
                                    jumpLevel.AppendPrePad(standard + "/" + Recipes.FindSynthesis("FSD", "Standard").Count + " Standard".T(EDTx.UserControlStarList_SFSD), ", ");
                                }
                                if (premium != 0)
                                {
                                    jumpLevel.AppendPrePad(premium + "/" + Recipes.FindSynthesis("FSD", "Premium").Count + " Premium".T(EDTx.UserControlStarList_PFSD), ", ");
                                }

                                jumponium = jumponium.AppendPrePad(Environment.NewLine + string.Format("{0} has {1} level elements.".T(EDTx.UserControlStarList_LE), sn.ScanData.BodyName, jumpLevel));
                            }
                        }
                    }

                    int total = sysnode.StarPlanetsScanned();

                    if (total > 0)
                    {
                        int totalwithoutstars = total - stars;

                        if (totalwithoutstars > 0)
                        {
                            infostr = infostr.AppendPrePad(string.Format("{0} Other bodies".T(EDTx.UserControlStarList_OB), totalwithoutstars.ToString()), ", ");
                        }

                        if (sysnode.FSSTotalBodies.HasValue && total < sysnode.FSSTotalBodies.Value)          // only show if you've not got them all
                        {
                            infostr += ", " + "Total".T(EDTx.UserControlStarList_Total) + " " + sysnode.FSSTotalBodies.Value.ToString();
                        }

                        infostr = infostr.AppendPrePad(extrainfo, prefix);
                    }
                    else
                    {   // we need this to allow the panel to scan also through systems which has only stars
                        infostr = infostr.AppendPrePad(extrainfo, prefix);
                    }
                    if (hasMaterials == true && checkBoxJumponium.Checked == true)
                    {
                        infostr = infostr.AppendPrePad(Environment.NewLine + Environment.NewLine + "This system has materials for FSD boost: ".T(EDTx.UserControlStarList_FSD));
                        infostr = infostr.AppendPrePad(jumponium);
                    }
                }
            }

            return(infostr);
        }
Exemplo n.º 5
0
        string Infoline(ISystem system, StarScan.SystemNode sysnode)
        {
            string infostr = "";

            if (sysnode?.StarNodes != null)
            {
                string st    = sysnode.StarTypesFound();
                int    stars = sysnode.StarsScanned();
                int    total = sysnode.StarPlanetsScanned();

                infostr = string.Format("{0} Star(s) {1}".T(EDTx.UserControlStarList_CS), stars, st);

                if (total > stars)
                {
                    infostr += " " + string.Format("{0} Other bodies".T(EDTx.UserControlStarList_OB), (total - stars).ToString());
                }

                if (sysnode.FSSTotalBodies.HasValue && total < sysnode.FSSTotalBodies.Value)        // only show if you've not got them all
                {
                    infostr += ", " + "Total".T(EDTx.UserControlStarList_Total) + " " + sysnode.FSSTotalBodies.Value.ToString();
                }

                bool showcodex = displayfilters.Contains("codex");

                if (sysnode.CodexEntryList.Count > 0 && showcodex)
                {
                    foreach (var c in sysnode.CodexEntryList)
                    {
                        infostr = infostr.AppendPrePad(c.Info(), Environment.NewLine);
                    }
                }


                string jumponium = "";

                // selectors for showing something
                bool showplanets      = displayfilters.Contains("planets");
                bool showstars        = displayfilters.Contains("stars");
                bool showvalueables   = displayfilters.Contains("valueables");
                bool showbeltclusters = displayfilters.Contains("beltcluster");

                // selectors for what to print
                bool showsignals  = displayfilters.Contains("signals");
                bool showvol      = displayfilters.Contains("volcanism");
                bool showv        = displayfilters.Contains("values");
                bool showsi       = displayfilters.Contains("shortinfo");
                bool showg        = displayfilters.Contains("gravity");
                bool showatmos    = displayfilters.Contains("atmos");
                bool showrings    = displayfilters.Contains("rings");
                bool showorganics = displayfilters.Contains("organics");

                bool showjumponium = displayfilters.Contains("jumponium");

                foreach (StarScan.ScanNode sn in sysnode.Bodies)
                {
                    if (sn?.ScanData != null)   // must have scan data..
                    {
                        if (
                            (sn.ScanData.IsBeltCluster && showbeltclusters) ||     // major selectors for line display
                            (sn.ScanData.IsPlanet && showplanets) ||
                            (sn.ScanData.IsStar && showstars) ||
                            (showvalueables && (sn.ScanData.AmmoniaWorld || sn.ScanData.CanBeTerraformable || sn.ScanData.WaterWorld || sn.ScanData.Earthlike))
                            )
                        {
                            string info = sn.SurveyorInfoLine(system, showsignals, showorganics,
                                                              showvol, showv, showsi, showg,
                                                              showatmos && sn.ScanData.IsLandable, showrings,
                                                              lowRadiusLimit, largeRadiusLimit, eccentricityLimit);
                            infostr = infostr.AppendPrePad(info, Environment.NewLine);
                        }

                        sn.ScanData.AccumulateJumponium(ref jumponium, sn.ScanData.BodyDesignationOrName);
                    }
                }

                if (jumponium.HasChars())
                {
                    infostr = infostr.AppendPrePad("This system has materials for FSD boost".T(EDTx.UserControlStarList_FSD), Environment.NewLine);
                    if (showjumponium)
                    {
                        infostr = infostr.AppendPrePad(jumponium, Environment.NewLine);
                    }
                }
            }

            return(infostr);
        }