void DrawSystem() // draw last_sn, last_he { dataGridViewEstimatedValues.Rows.Clear(); if (last_he == null) { SetControlText("No Scan".Tx()); return; } StarScan.SystemNode last_sn = discoveryform.history.starscan.FindSystem(last_he.System, true); SetControlText((last_sn == null) ? "No Scan".Tx() : string.Format("Estimated Scan Values for {0}".Tx(this, "SV"), last_sn.system.Name)); if (last_sn != null) { List <StarScan.ScanNode> all_nodes = new List <StarScan.ScanNode>(); foreach (StarScan.ScanNode starnode in last_sn.starnodes.Values) { all_nodes = Flatten(starnode, all_nodes); } // flatten tree of scan nodes to prepare for listing foreach (StarScan.ScanNode sn in all_nodes) { if (sn.ScanData != null && sn.ScanData.BodyName != null) { dataGridViewEstimatedValues.Rows.Add(new object[] { sn.ScanData.BodyName, sn.ScanData.EstimatedValue }); } } dataGridViewEstimatedValues.Sort(this.EstValue, ListSortDirection.Descending); } }
void DrawSystem() // draw showing_system (may be null), showing_matcomds (may be null) { panelStars.HideInfo(); StarScan.SystemNode data = panelStars.FindSystem(showing_system, discoveryform.history); string control_text = "No System"; if (showing_system != null) { control_text = showing_system.Name; if (data != null) { long value = data.ScanValue(checkBoxEDSM.Checked); control_text += " ~ " + value.ToString("N0") + " cr"; int scanned = data.StarPlanetsScanned(); if (scanned > 0) { control_text += " " + "Scan".T(EDTx.UserControlSurveyor_Scan) + " " + scanned.ToString() + (data.FSSTotalBodies != null ? (" / " + data.FSSTotalBodies.Value.ToString()) : ""); } } else { control_text += " " + "No Scan".T(EDTx.NoScan); } } panelStars.DrawSystem(data, showing_matcomds, discoveryform.history, (HasControlTextArea() && !extCheckBoxDisplaySystemAlways.Checked) ? null : control_text, bodyfilters); SetControlText(control_text); }
string Infoline(List <HistoryEntry> syslist) { string infostr = ""; if (syslist.Count > 1) { infostr = "First visit " + syslist.Last().EventTimeLocal.ToShortDateString(); } HistoryEntry he = syslist[0]; StarScan.SystemNode node = discoveryform.history.starscan?.FindSystem(he.System); if (node != null) { if (node.starnodes != null) { infostr = infostr.AppendPrePad(node.starnodes.Count.ToStringInvariant() + " Star" + ((node.starnodes.Count > 1) ? "s" : ""), Environment.NewLine); int total = 0; foreach (StarScan.ScanNode sn in node.Bodies) { total++; } total -= node.starnodes.Count; if (total > 0) { infostr = infostr.AppendPrePad(total.ToStringInvariant() + " Other bod" + ((total > 1) ? "ies" : "y"), ", "); } } } return(infostr); }
async void DrawSystem() // draw last_he { dataGridViewEstimatedValues.Rows.Clear(); if (last_he == null) { SetControlText("No Scan".T(EDTx.NoScan)); return; } StarScan.SystemNode last_sn = await discoveryform.history.starscan.FindSystemAsync(last_he.System, checkBoxEDSM.Checked); SetControlText((last_sn == null) ? "No Scan".T(EDTx.NoScan) : string.Format("Estimated Scan Values for {0}".T(EDTx.UserControlEstimatedValues_SV), last_sn.system.Name)); if (last_sn != null) { foreach (var bodies in last_sn.Bodies) { if (bodies.ScanData != null && bodies.ScanData.BodyName != null && (checkBoxEDSM.Checked || !bodies.ScanData.IsEDSMBody)) // if check edsm, or not edsm body, with scandata { dataGridViewEstimatedValues.Rows.Add(new object[] { bodies.ScanData.BodyName, bodies.ScanData.IsEDSMBody ? "EDSM" : "", bodies.ScanData.EstimatedValue }); } } dataGridViewEstimatedValues.Sort(this.EstValue, ListSortDirection.Descending); } }
async void DrawSystem() // draw last_he { DataGridViewColumn sortcol = dataGridViewEstimatedValues.SortedColumn != null ? dataGridViewEstimatedValues.SortedColumn : dataGridViewEstimatedValues.Columns[6]; SortOrder sortorder = dataGridViewEstimatedValues.SortOrder != SortOrder.None ? dataGridViewEstimatedValues.SortOrder : SortOrder.Descending; dataGridViewEstimatedValues.Rows.Clear(); if (last_he == null) { SetControlText("No Scan".T(EDTx.NoScan)); return; } StarScan.SystemNode last_sn = await discoveryform.history.StarScan.FindSystemAsync(last_he.System, checkBoxEDSM.Checked); SetControlText((last_sn == null) ? "No Scan".T(EDTx.NoScan) : string.Format("Estimated Scan Values for {0}".T(EDTx.UserControlEstimatedValues_SV), last_sn.System.Name)); if (last_sn != null) { foreach (var bodies in last_sn.Bodies) { if (bodies.ScanData != null && bodies.ScanData.BodyName != null && (checkBoxEDSM.Checked || !bodies.ScanData.IsEDSMBody)) // if check edsm, or not edsm body, with scandata { string spclass = bodies.ScanData.IsStar ? bodies.ScanData.StarTypeText : bodies.ScanData.PlanetTypeText; dataGridViewEstimatedValues.Rows.Add(new object[] { bodies.ScanData.BodyDesignationOrName, spclass, bodies.ScanData.IsEDSMBody ? "EDSM" : "", (bodies.IsMapped ? Icons.Controls.Scan_Bodies_Mapped : null), (bodies.ScanData.WasMapped == true? Icons.Controls.Scan_Bodies_Mapped : null), (bodies.ScanData.WasDiscovered == true ? Icons.Controls.Scan_DisplaySystemAlways : null), bodies.ScanData.EstimatedValue }); } } dataGridViewEstimatedValues.Sort(sortcol, (sortorder == SortOrder.Descending) ? System.ComponentModel.ListSortDirection.Descending : System.ComponentModel.ListSortDirection.Ascending); dataGridViewEstimatedValues.Columns[sortcol.Index].HeaderCell.SortGlyphDirection = sortorder; } }
void DrawSystem() // draw showing_system (may be null), showing_matcomds (may be null) { panelStars.HideInfo(); StarScan.SystemNode data = panelStars.FindSystem(showing_system, discoveryform.history); string control_text = "No System"; if (showing_system != null) { control_text = showing_system.Name; if (data != null) { long value = data.ScanValue(checkBoxEDSM.Checked); control_text += " ~ " + value.ToString("N0") + " cr"; } else { control_text += " " + "No Scan".T(EDTx.NoScan); } } panelStars.DrawSystem(data, showing_matcomds, discoveryform.history, (HasControlTextArea() && !extCheckBoxDisplaySystemAlways.Checked) ? null : control_text, bodyfilters); SetControlText(control_text); }
public void NewEntry(HistoryEntry he, HistoryList hl) // called when a new entry is made.. check to see if its a scan update { // affecting our system StarScan.SystemNode newnode = (he != null) ? hl.starscan.FindSystem(he.System) : null; // find node.. if (newnode == last_sn && he.EntryType == EliteDangerous.JournalTypeEnum.Scan) // if on same star system, and its a scan, it may have been updated.. { DrawSystem(last_sn); } }
// draw scannode (may be null), // curmats may be null public void DrawSystem(StarScan.SystemNode systemnode, List <MaterialCommodityMicroResource> historicmats, List <MaterialCommodityMicroResource> curmats, string opttext = null, string[] filter = null) { HideInfo(); SystemDisplay.BackColor = this.BackColor; SystemDisplay.LabelColor = EDDTheme.Instance.LabelColor; SystemDisplay.DrawSystem(imagebox, WidthAvailable, systemnode, historicmats, curmats, opttext, filter); imagebox.Render(); // replaces image.. }
public void Display(HistoryEntry he, HistoryList hl) // when user clicks around.. { StarScan.SystemNode newnode = (he != null) ? hl.starscan.FindSystem(he.System) : null; if (newnode != last_sn) { last_sn = newnode; DrawSystem(last_sn); } }
// when user clicks around.. public void Display(HistoryEntry he, HistoryList hl) { StarScan.SystemNode newnode = (he != null) ? hl.starscan.FindSystem(he.System) : null; if (newnode != last_sn) { last_sn = newnode; DrawSystem(last_sn); } }
async void DrawSystem() // draw showing_system (may be null), showing_matcomds (may be null) { panelStars.HideInfo(); // showing_system = new SystemClass("Qi Lieh"); //showing_system = new SystemClass("Pallaeni"); - problem with shrinking lines // showing_system = new SystemClass("Borann"); //showing_system = new SystemClass("Skaudai AM-B d14-138"); //showing_system = new SystemClass("Eorgh Prou JH-V e2-1979"); // showing_system = new SystemClass("HYPAA FLYIAE CB-O D6-8"); #if PLAYTHRU StarScan.SystemNode data = showing_system != null ? await discoveryform.history.starscan.FindSystemAsync(showing_system, false, byname : true) : null; #else StarScan.SystemNode data = showing_system != null ? await discoveryform.history.StarScan.FindSystemAsync(showing_system, checkBoxEDSM.Checked) : null; #endif string control_text = "No System"; if (showing_system != null) { control_text = showing_system.Name; if (data != null) { long value = data.ScanValue(checkBoxEDSM.Checked); control_text += " ~ " + value.ToString("N0") + " cr"; int scanned = data.StarPlanetsScanned(); if (scanned > 0) { control_text += " " + "Scan".T(EDTx.UserControlSurveyor_Scan) + " " + scanned.ToString() + (data.FSSTotalBodies != null ? (" / " + data.FSSTotalBodies.Value.ToString()) : ""); } int fsssignals = data.FSSSignalList.Count; if (fsssignals > 0) { control_text += " " + " Signals " + fsssignals.ToString(); } } else { control_text += " " + "No Scan".T(EDTx.NoScan); } } var curmats = discoveryform.history.MaterialCommoditiesMicroResources.GetLast(); panelStars.DrawSystem(data, showing_matcomds, curmats, (HasControlTextArea() && !displayfilters.Contains("sys")) ? null : control_text, bodyfilters); SetControlText(control_text); }
async void DrawSystem() // draw last_he { DataGridViewColumn sortcol = dataGridViewEstimatedValues.SortedColumn != null ? dataGridViewEstimatedValues.SortedColumn : dataGridViewEstimatedValues.Columns[6]; SortOrder sortorder = dataGridViewEstimatedValues.SortOrder != SortOrder.None ? dataGridViewEstimatedValues.SortOrder : SortOrder.Descending; dataGridViewEstimatedValues.Rows.Clear(); if (last_he == null) { SetControlText("No Scan".T(EDTx.NoScan)); return; } StarScan.SystemNode last_sn = await discoveryform.history.StarScan.FindSystemAsync(last_he.System, checkBoxEDSM.Checked); SetControlText((last_sn == null) ? "No Scan".T(EDTx.NoScan) : string.Format("Estimated Scan Values for {0}".T(EDTx.UserControlEstimatedValues_SV), last_sn.System.Name)); if (last_sn != null) { foreach (var bodies in last_sn.Bodies) { if (bodies.ScanData != null && bodies.ScanData.BodyName != null && (checkBoxEDSM.Checked || !bodies.ScanData.IsEDSMBody)) // if check edsm, or not edsm body, with scandata { System.Diagnostics.Debug.WriteLine("Recalc for " + bodies.ScanData.BodyName); var ev = bodies.ScanData.RecalcEstimatedValues(); if (!checkBoxShowZeros.Checked && ev.EstimatedValueBase == 0) { continue; // skip 0-value things } string spclass = bodies.ScanData.IsStar ? bodies.ScanData.StarTypeText : bodies.ScanData.PlanetTypeText; dataGridViewEstimatedValues.Rows.Add(new object[] { GetBodySimpleName(bodies.ScanData.BodyDesignationOrName, last_he.System.Name), spclass, bodies.ScanData.IsEDSMBody ? "EDSM" : "", (bodies.IsMapped ? Icons.Controls.Scan_Bodies_Mapped : null), (bodies.ScanData.WasMapped == true? Icons.Controls.Scan_Bodies_Mapped : null), (bodies.ScanData.WasDiscovered == true ? Icons.Controls.Scan_DisplaySystemAlways : null), ev.EstimatedValueBase.ToString("N0"), ev.EstimatedValueMapped > 0 ? (ev.EstimatedValueMappedEfficiently.ToString("N0") + " / " + ev.EstimatedValueMapped.ToString("N0")) : "", ev.EstimatedValueFirstDiscovered > 0 ? ev.EstimatedValueFirstDiscovered.ToString("N0") : "", ev.EstimatedValueFirstMappedEfficiently > 0 ? (ev.EstimatedValueFirstMappedEfficiently.ToString("N0") + " / " + ev.EstimatedValueFirstMapped.ToString("N0")) : "", ev.EstimatedValueFirstDiscoveredFirstMappedEfficiently > 0 ? (ev.EstimatedValueFirstDiscoveredFirstMappedEfficiently.ToString("N0") + " / " + ev.EstimatedValueFirstDiscoveredFirstMapped.ToString("N0")):"", bodies.ScanData.EstimatedValue.ToString("N0") }); } } dataGridViewEstimatedValues.Sort(sortcol, (sortorder == SortOrder.Descending) ? System.ComponentModel.ListSortDirection.Descending : System.ComponentModel.ListSortDirection.Ascending); dataGridViewEstimatedValues.Columns[sortcol.Index].HeaderCell.SortGlyphDirection = sortorder; } }
private void DrawBodyInfo() { //System.Diagnostics.Debug.WriteLine($"Organics {displaynumber} Draw {lasthe?.System.Name} {lasthe?.System.HasCoordinate}"); pictureBox.ClearImageList(); if (lasthe != null && lasthe.Status.HasBodyID && lasthe.Status.BodyType == "Planet") { StarScan.SystemNode data = discoveryform.history.StarScan.FindSystemSynchronous(lasthe.System, false); if (data != null && data.NodesByID.TryGetValue(lasthe.Status.BodyID.Value, out StarScan.ScanNode node)) { var picelements = new List <ExtPictureBox.ImageElement>(); // accumulate picture elements in here Font dfont = displayfont ?? this.Font; // System.Diagnostics.Debug.WriteLine($"Organics {displaynumber} Go for draw on {lasthe.WhereAmI} {lasthe.BodyType}"); int vpos = 0; StringFormat frmt = new StringFormat(extCheckBoxWordWrap.Checked ? 0 : StringFormatFlags.NoWrap); frmt.Alignment = StringAlignment.Near; var textcolour = IsTransparent ? ExtendedControls.Theme.Current.SPanelColor : ExtendedControls.Theme.Current.LabelColor; var backcolour = IsTransparent ? Color.Transparent : this.BackColor; //System.Diagnostics.Debug.WriteLine($"Pbox size {pictureBox.Size}"); string l = string.Format("At {0}, {1}, Radius {2}, {3} G, {4}", node.FullName, node.ScanData?.PlanetTypeText ?? "Unknown", node.ScanData?.RadiusText() ?? "Unknown", node.ScanData?.nSurfaceGravityG?.ToString("N1") ?? "Unknown", node.ScanData?.Atmosphere); string s = node.Organics != null?JournalScanOrganic.OrganicList(node.Organics) : "No organic scanned"; var i = new ExtPictureBox.ImageElement(); i.TextAutoSize(new Point(3, vpos), new Size(Math.Max(pictureBox.Width - 6, 24), 10000), l.AppendPrePad(s, Environment.NewLine), dfont, textcolour, backcolour, 1.0F, frmt: frmt);; extPictureBoxScroll.Height = i.Location.Bottom + 8; picelements.Add(i); frmt.Dispose(); pictureBox.AddRange(picelements); extPictureBoxScroll.Render(); Refresh(); } } }
private string BuildScanValue(StarScan.SystemNode system) { var value = 0; foreach (var body in system.Bodies) { if (body?.ScanData?.EstimatedValue != null) { value += body.ScanData.EstimatedValue; } } return($"Approx total scan value: {value:N0}"); }
private string BuildScanValue(StarScan.SystemNode system) { var value = 0; foreach (var body in system.Bodies) { if (body.ScanData != null) { value += body.ScanData.EstimateScanValue(body.IsMapped, body.WasMappedEfficiently); } } return(string.Format("Estimated total scan value: {0:N0}".Tx(this, "AV"), value)); }
private string BuildScanValue(StarScan.SystemNode system) { var value = 0; foreach (var body in system.Bodies) { if (body?.ScanData?.EstimatedValue != null) { value += body.ScanData.EstimatedValue; } } return(string.Format("Approx total scan value: {0:N0}".Tx(this, "AV"), value)); }
private string BuildScanValue(StarScan.SystemNode system) { var value = 0; foreach (var body in system.Bodies) { if (body?.ScanData != null) { if (checkBoxEDSM.Checked || !body.ScanData.IsEDSMBody) { value += body.ScanData.EstimateScanValue(body.IsMapped, body.WasMappedEfficiently); } } } return(string.Format("Approx value: {0:N0}".Tx(this, "AV"), value)); }
void DrawSystem() // draw showing_system (may be null), showing_matcomds (may be null) { panelStars.HideInfo(); lblSystemInfo.Text = ""; StarScan.SystemNode data = panelStars.DrawSystem(showing_system, showing_matcomds, discoveryform.history); if (showing_system == null) { SetControlText("No System"); } else { SetControlText(data == null ? "No Scan".Tx() : data.system.Name); } }
void DrawSystem() // draw last_sn, last_he { dataGridViewNearest.Rows.Clear(); if (last_he == null) { SetControlText("No Scan"); return; } StarScan.SystemNode last_sn = _discoveryForm.history.starscan.FindSystem(last_he.System, true); SetControlText((last_sn == null) ? "No Scan" : ("Estimated Scan Values for " + last_sn.system.name)); if (last_sn != null) { List <StarScan.ScanNode> all_nodes = new List <StarScan.ScanNode>(); foreach (StarScan.ScanNode starnode in last_sn.starnodes.Values) { all_nodes = Flatten(starnode, all_nodes); } // flatten tree of scan nodes to prepare for listing foreach (StarScan.ScanNode sn in all_nodes) { // no ScanData for barycentres or belts try { dataGridViewNearest.Rows.Add(new object[] { sn.ScanData.BodyName, sn.ScanData.EstimatedValue() }); } catch { // System.Diagnostics.Debug.WriteLine("failed to add row with fullname " + sn.fullname); } } dataGridViewNearest.Sort(this.EstValue, ListSortDirection.Descending); } }
void DrawSystem() // draw showing_system (may be null), showing_matcomds (may be null) { panelStars.HideInfo(); StarScan.SystemNode data = panelStars.DrawSystem(showing_system, showing_matcomds, discoveryform.history); if (showing_system == null) { SetControlText("No System"); } else { if (data != null) { long value = data.ScanValue(checkBoxEDSM.Checked); SetControlText(data.system.Name + " (~" + value.ToString() + " cr)"); } else { SetControlText(data == null ? "No Scan".Tx() : data.system.Name); } } }
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.FindSystemSynchronous(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 = ""; } } }
public override bool ExecuteAction(ActionProgramRun ap) { string res; if (ap.functions.ExpandString(UserData, out res) != Conditions.ConditionFunctions.ExpandResult.Failed) { StringParser sp = new StringParser(res); string prefix = "S_"; string cmdname = sp.NextQuotedWord(); if (cmdname != null && cmdname.Equals("PREFIX", StringComparison.InvariantCultureIgnoreCase)) { prefix = sp.NextWord(); if (prefix == null) { ap.ReportError("Missing name after Prefix in Scan"); return(true); } cmdname = sp.NextQuotedWord(); } bool edsm = false; if (cmdname != null && cmdname.Equals("EDSM", StringComparison.InvariantCultureIgnoreCase)) { edsm = true; cmdname = sp.NextQuotedWord(); } if (cmdname != null) { StarScan scan = (ap.actioncontroller as ActionController).HistoryList.starscan; ISystem sc = SystemClassDB.GetSystem(cmdname); if (sc == null) { sc = new SystemClass(cmdname); sc.EDSMID = 0; } StarScan.SystemNode sn = scan.FindSystem(sc, edsm); System.Globalization.CultureInfo ct = System.Globalization.CultureInfo.InvariantCulture; if (sn != null) { int starno = 1; ap[prefix + "Stars"] = sn.starnodes.Count.ToString(ct); foreach (KeyValuePair <string, StarScan.ScanNode> scannode in sn.starnodes) { DumpInfo(ap, scannode, prefix + "Star_" + starno.ToString(ct), "_Planets"); int pcount = 1; if (scannode.Value.children != null) { foreach (KeyValuePair <string, StarScan.ScanNode> planetnodes in scannode.Value.children) { DumpInfo(ap, planetnodes, prefix + "Planet_" + starno.ToString(ct) + "_" + pcount.ToString(ct), "_Moons"); if (planetnodes.Value.children != null) { int mcount = 1; foreach (KeyValuePair <string, StarScan.ScanNode> moonnodes in planetnodes.Value.children) { DumpInfo(ap, moonnodes, prefix + "Moon_" + starno.ToString(ct) + "_" + pcount.ToString(ct) + "_" + mcount.ToString(ct), "_Submoons"); if (moonnodes.Value.children != null) { int smcount = 1; foreach (KeyValuePair <string, StarScan.ScanNode> submoonnodes in moonnodes.Value.children) { DumpInfo(ap, submoonnodes, prefix + "SubMoon_" + starno.ToString(ct) + "_" + pcount.ToString(ct) + "_" + mcount.ToString(ct) + "_" + smcount.ToString(ct), null); smcount++; } } mcount++; } } pcount++; } } starno++; } } else { ap[prefix + "Stars"] = "0"; } } else { ap.ReportError("Missing starname in Scan"); } } else { ap.ReportError(res); } return(true); }
string Infoline(List <HistoryEntry> syslist) { string infostr = ""; string jumponium = ""; bool hasMaterials = false; if (syslist.Count > 1) { infostr = string.Format("First visit {0}".Tx(this, "FV"), syslist.Last().EventTimeLocal.ToShortDateString()); } HistoryEntry he = syslist[0]; StarScan.SystemNode node = discoveryform.history.starscan?.FindSystem(he.System, false); #region information if (node != null) { if (node.starnodes != null) { infostr = infostr.AppendPrePad(string.Format("{0} Star(s)".Tx(this, "CS"), node.starnodes.Count), Environment.NewLine); string extrainfo = ""; string prefix = Environment.NewLine; int total = 0; foreach (StarScan.ScanNode sn in node.Bodies) { total++; if (sn.ScanData != null && checkBoxBodyClasses.Checked) { JournalScan sc = sn.ScanData; 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) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is a super massive black hole".Tx(this, "SMBH"), sc.BodyName), prefix); } // black holes if (sc.StarTypeID == EDStar.H) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is a black hole".Tx(this, "BH"), sc.BodyName), prefix); } // neutron stars if (sc.StarTypeID == EDStar.N) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is a neutron star".Tx(this, "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)) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is a {1} white dwarf star".Tx(this, "WD"), sc.BodyName, sc.StarTypeID), prefix); } // wolf rayet (W, WN, WNC, WC, WO) string WolfRayet = "Wolf-Rayet"; if (sc.StarTypeText.Contains(WolfRayet)) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is a {1} wolf-rayet star".Tx(this, "WR"), sc.BodyName, sc.StarTypeID), prefix); } // giants. It should recognize all classes of giants. if (sc.StarTypeText.Contains("Giant")) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is a {1}".Tx(this, "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) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is a rogue planet".Tx(this, "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) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is an earth like moon".Tx(this, "ELM"), sc.BodyName), prefix); } // Terraformable water moon if (sc.Terraformable == true && sc.PlanetTypeID == EDPlanet.Water_world) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is a terraformable water moon".Tx(this, "TWM"), sc.BodyName), prefix); } // Water moon if (sc.Terraformable == false && sc.PlanetTypeID == EDPlanet.Water_world) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is a water moon".Tx(this, "WM"), sc.BodyName), prefix); } // Terraformable moon if (sc.Terraformable == true && sc.PlanetTypeID != EDPlanet.Water_world) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is a terraformable moon".Tx(this, "TM"), sc.BodyName), prefix); } // Ammonia moon if (sc.PlanetTypeID == EDPlanet.Ammonia_world) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is an ammonia moon".Tx(this, "AM"), sc.BodyName), prefix); } } else // Do the same, for all planets { // Earth Like planet if (sc.PlanetTypeID == EDPlanet.Earthlike_body) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is an earth like planet".Tx(this, "ELP"), sc.BodyName), prefix); } // Terraformable water world if (sc.PlanetTypeID == EDPlanet.Water_world && sc.Terraformable == true) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is a terraformable water world".Tx(this, "TWW"), sc.BodyName), prefix); } // Water world if (sc.PlanetTypeID == EDPlanet.Water_world && sc.Terraformable == false) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is a water world".Tx(this, "WW"), sc.BodyName), prefix); } // Terraformable planet if (sc.Terraformable == true && sc.PlanetTypeID != EDPlanet.Water_world) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is a terraformable planet".Tx(this, "TP"), sc.BodyName), prefix); } // Ammonia world if (sc.PlanetTypeID == EDPlanet.Ammonia_world) { extrainfo = extrainfo.AppendPrePad(string.Format("{0} is an ammonia world".Tx(this, "AW"), sc.BodyName), 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".Tx(this, "BFSD"), ", "); } if (standard != 0) { jumpLevel.AppendPrePad(standard + "/" + Recipes.FindSynthesis("FSD", "Standard").Count + " Standard".Tx(this, "SFSD"), ", "); } if (premium != 0) { jumpLevel.AppendPrePad(premium + "/" + Recipes.FindSynthesis("FSD", "Premium").Count + " Premium".Tx(this, "PFSD"), ", "); } jumponium = jumponium.AppendPrePad(Environment.NewLine + string.Format("{0} has {1} level elements.".Tx(this, "LE"), sn.ScanData.BodyName, jumpLevel)); } } } total -= node.starnodes.Count; if (total > 0) { // tell us that a system has other bodies, and how much, beside stars infostr = infostr.AppendPrePad(string.Format("{0} Other bodies".Tx(this, "OB"), total.ToStringInvariant()), ", "); 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: ".Tx(this, "FSD")); infostr = infostr.AppendPrePad(jumponium); } } } return(infostr); }
void DrawSystem(StarScan.SystemNode sn) { imagebox.Clear(); HideInfo(); last_sn = sn; // remember in case we need to draw SetControlText((sn == null) ? "No Scan" : sn.system.name); if (sn == null) return; Point curpos = new Point(leftmargin, topmargin); last_maxdisplayarea = curpos; List<PictureBoxHotspot.ImageElement> starcontrols = new List<PictureBoxHotspot.ImageElement>(); //for( int i = 0; i < 1000; i +=100) CreateStarPlanet(starcontrols, EDDiscovery.Properties.Resources.ImageStarDiscWhite, new Point(i, 0), new Size(24, 24), i.ToString(), ""); foreach (StarScan.ScanNode starnode in sn.starnodes.Values) // always has scan nodes { int offset = 0; Point maxstarpos = DrawNode(starcontrols, starnode, (starnode.type == StarScan.ScanNodeType.barycentre ) ? EDDiscovery.Properties.Resources.Barycentre : JournalScan.GetStarImageNotScanned() , curpos , starsize, ref offset, false); Point maxitemspos = maxstarpos; curpos = new Point(maxitemspos.X + itemsepar.Width, curpos.Y); // move to the right curpos.Y += starsize.Height / 2 - planetsize.Height * 3 / 4; // slide down for planet vs star difference in size Point firstcolumn = curpos; if (starnode.children != null) { foreach (StarScan.ScanNode planetnode in starnode.children.Values) { List<PictureBoxHotspot.ImageElement> pc = new List<PictureBoxHotspot.ImageElement>(); Point maxpos = CreatePlanetTree(pc, planetnode, curpos); //System.Diagnostics.Debug.WriteLine("Planet " + planetnode.ownname + " " + curpos + " " + maxpos + " max " + (panelStars.Width - panelStars.ScrollBarWidth)); if ( maxpos.X > panelStars.Width - panelStars.ScrollBarWidth) // uh oh too wide.. { int xoffset = firstcolumn.X - curpos.X; int yoffset = maxitemspos.Y - curpos.Y; RepositionTree(pc, xoffset, yoffset); // shift co-ords of all you've drawn maxpos = new Point(maxpos.X + xoffset, maxpos.Y + yoffset); curpos = new Point(maxpos.X, curpos.Y + yoffset); } else curpos = new Point(maxpos.X, curpos.Y); maxitemspos = new Point(Math.Max(maxitemspos.X, maxpos.X), Math.Max(maxitemspos.Y, maxpos.Y)); starcontrols.AddRange(pc.ToArray()); } } last_maxdisplayarea = new Point(Math.Max(last_maxdisplayarea.X, maxitemspos.X), Math.Max(last_maxdisplayarea.Y, maxitemspos.Y)); curpos = new Point(leftmargin, maxitemspos.Y + itemsepar.Height); } imagebox.AddRange(starcontrols); imagebox.Render(); //System.Diagnostics.Debug.WriteLine("Display area " + last_maxdisplayarea); }
public static async void ShowScanOrMarketForm(Form parent, Object tag, bool checkedsm, HistoryList hl) // tag can be a Isystem or an He.. output depends on it. { if (tag == null) { return; } ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm(); Size infosize = parent.SizeWithinScreen(new Size(parent.Width * 6 / 8, parent.Height * 6 / 8), 128, 128 + 100); // go for this, but allow this around window int topmargin = 40; HistoryEntry he = tag as HistoryEntry; // is tag HE? ISystem sys = he != null ? he.System : tag as ISystem; // if so, sys is he.system, else its a direct sys ScanDisplayUserControl sd = null; string title = "System".T(EDTx.ScanDisplayForm_Sys) + ": " + sys.Name; AutoScaleMode asm = AutoScaleMode.Font; if (he != null && (he.EntryType == JournalTypeEnum.Market || he.EntryType == JournalTypeEnum.EDDCommodityPrices)) // station data.. { he.FillInformation(out string info, out string detailed); f.Add(new ExtendedControls.ConfigurableForm.Entry("RTB", typeof(ExtendedControls.ExtRichTextBox), detailed, new Point(0, topmargin), infosize, null)); JournalCommodityPricesBase jm = he.journalEntry as JournalCommodityPricesBase; title += ", " + "Station".T(EDTx.ScanDisplayForm_Station) + ": " + jm.Station; } else { sd = new ScanDisplayUserControl(); sd.CheckEDSM = checkedsm; int selsize = (int)(EDDTheme.Instance.GetFont.Height / 16.0f * 48.0f); sd.SetSize(selsize); sd.Size = infosize; StarScan.SystemNode data = await hl.StarScan.FindSystemAsync(sys, sd.CheckEDSM); // look up system async if (data != null) { long value = data.ScanValue(sd.CheckEDSM); title += " ~ " + value.ToString("N0") + " cr"; } sd.BackColor = EDDTheme.Instance.Form; sd.DrawSystem(data, null, hl); int wastedh = infosize.Height - sd.DisplayAreaUsed.Y - 10 - 40; if (wastedh > 0) { infosize.Height -= wastedh; } asm = AutoScaleMode.None; // because we are using a picture box, it does not autoscale, so we can't use that logic on it. f.Add(new ExtendedControls.ConfigurableForm.Entry("Sys", null, null, new Point(0, topmargin), infosize, null) { control = sd }); } f.AddOK(new Point(infosize.Width - 120, topmargin + infosize.Height + 10)); f.Trigger += (dialogname, controlname, ttag) => { if (controlname == "OK") { f.ReturnResult(DialogResult.OK); } else if (controlname == "Close") { f.ReturnResult(DialogResult.Cancel); } }; f.InitCentred(parent, parent.Icon, title, null, null, asm, closeicon: true); f.Show(parent); }
// draw scannode (may be null), // curmats may be null public void DrawSystem(StarScan.SystemNode scannode, MaterialCommoditiesList curmats, HistoryList hl, string opttext = null, string[] filter = null) { HideInfo(); imagebox.ClearImageList(); // does not clear the image, render will do that if (scannode != null) { Point leftmiddle = new Point(leftmargin, topmargin + StarSize.Height * nodeheightratio / 2 / noderatiodivider); // half down (h/2 * ratio) if (opttext != null) { ExtPictureBox.ImageElement lab = new ExtPictureBox.ImageElement(); lab.TextAutosize(new Point(leftmargin, 0), new Size(500, 30), opttext, largerfont, EDDTheme.Instance.LabelColor, this.BackColor); imagebox.Add(lab); leftmiddle.Y += lab.Image.Height + 8; } DisplayAreaUsed = leftmiddle; List <ExtPictureBox.ImageElement> starcontrols = new List <ExtPictureBox.ImageElement>(); bool displaybelts = filter == null || (filter.Contains("belt") || filter.Contains("All")); Point maxitemspos = new Point(0, 0); foreach (StarScan.ScanNode starnode in scannode.starnodes.Values) // always has scan nodes { if (filter != null && starnode.IsBodyInFilter(filter, true) == false) // if filter active, but no body or children in filter { // System.Diagnostics.Debug.WriteLine("SDUC Rejected " + starnode.fullname); continue; } // Draw star Point maxstarpos = DrawNode(starcontrols, starnode, curmats, hl, (starnode.type == StarScan.ScanNodeType.barycentre) ? Icons.Controls.Scan_Bodies_Barycentre : JournalScan.GetStarImageNotScanned(), leftmiddle, false, out int unusedstarcentre, StarSize, DrawLevel.TopLevelStar); // the last part nerfs the label down to the right position maxitemspos = new Point(Math.Max(maxitemspos.X, maxstarpos.X), Math.Max(maxitemspos.Y, maxstarpos.Y)); if (starnode.children != null) { leftmiddle = new Point(maxitemspos.X + starfirstplanetspacerx, leftmiddle.Y); Point firstcolumn = leftmiddle; Queue <StarScan.ScanNode> belts; if (starnode.ScanData != null && (!starnode.ScanData.IsEDSMBody || CheckEDSM)) // have scandata on star, and its not edsm or allowed edsm { belts = new Queue <StarScan.ScanNode>(starnode.children.Values.Where(s => s.type == StarScan.ScanNodeType.belt)); // find belts in children of star } else { belts = new Queue <StarScan.ScanNode>(); // empty array } StarScan.ScanNode lastbelt = belts.Count != 0 ? belts.Dequeue() : null; double habzonestartls = starnode.ScanData?.HabitableZoneInner ?? 0; double habzoneendls = starnode.ScanData?.HabitableZoneOuter ?? 0; // process body and stars only List <StarScan.ScanNode> planetsinorder = starnode.children.Values.Where(s => s.type == StarScan.ScanNodeType.body || s.type == StarScan.ScanNodeType.star).ToList(); var planetcentres = new Dictionary <StarScan.ScanNode, Point>(); for (int pn = 0; pn < planetsinorder.Count; pn++) { StarScan.ScanNode planetnode = planetsinorder[pn]; if (filter != null && planetnode.IsBodyInFilter(filter, true) == false) // if filter active, but no body or children in filter { //System.Diagnostics.Debug.WriteLine("SDUC Rejected " + planetnode.fullname); continue; } //System.Diagnostics.Debug.WriteLine("Draw " + planetnode.ownname + ":" + planetnode.type); // if belt is before this, display belts here while (displaybelts && lastbelt != null && planetnode.ScanData != null && (lastbelt.BeltData == null || planetnode.ScanData.IsOrbitingBaryCentre || lastbelt.BeltData.OuterRad < planetnode.ScanData.nSemiMajorAxis)) { // if too far across, go back to star if (leftmiddle.X + planetsize.Width > panelStars.Width - panelStars.ScrollBarWidth) // if too far across.. { leftmiddle = new Point(firstcolumn.X, maxitemspos.Y + planetspacery + planetsize.Height / 2); // move to left at maxy+space+h/2 } string appendlabel = ""; if (lastbelt.BeltData != null) { appendlabel = appendlabel.AppendPrePad($"{lastbelt.BeltData.OuterRad / JournalScan.oneLS_m:N1}ls", Environment.NewLine); } appendlabel = appendlabel.AppendPrePad("" + lastbelt.ScanData?.BodyID, Environment.NewLine); Point maxbeltpos = DrawNode(starcontrols, lastbelt, curmats, hl, Icons.Controls.Scan_Bodies_Belt, leftmiddle, false, out int unusedbeltcentre, beltsize, DrawLevel.PlanetLevel, appendlabeltext: appendlabel); leftmiddle = new Point(maxbeltpos.X + planetspacerx, leftmiddle.Y); lastbelt = belts.Count != 0 ? belts.Dequeue() : null; maxitemspos = new Point(Math.Max(maxitemspos.X, maxbeltpos.X), Math.Max(maxitemspos.Y, maxbeltpos.Y)); } //System.Diagnostics.Debug.WriteLine("Planet Node " + planetnode.ownname + " has scans " + nonedsmscans); if (planetnode.DoesNodeHaveNonEDSMScansBelow() || CheckEDSM) { List <ExtPictureBox.ImageElement> pc = new List <ExtPictureBox.ImageElement>(); bool habzone = false; if (ShowHabZone && planetnode.ScanData != null && !planetnode.ScanData.IsOrbitingBaryCentre && planetnode.ScanData.nSemiMajorAxis.HasValue) { double dist = planetnode.ScanData.nSemiMajorAxis.Value / JournalScan.oneLS_m; // m , converted to LS habzone = dist >= habzonestartls && dist <= habzoneendls; } Point maxplanetpos = CreatePlanetTree(pc, planetnode, curmats, hl, leftmiddle, filter, habzone, out int centreplanet); Point pcnt = new Point(centreplanet, leftmiddle.Y); if (maxplanetpos.X > panelStars.Width - panelStars.ScrollBarWidth) // uh oh too wide.. { int xoff = firstcolumn.X - leftmiddle.X; // shift to firstcolumn.x, maxitemspos.Y+planetspacer int yoff = (maxitemspos.Y + planetspacery) - (leftmiddle.Y - planetsize.Height / 2); RepositionTree(pc, xoff, yoff); // shift co-ords of all you've drawn - this will include any bary points drawn in moons pcnt.X += xoff; pcnt.Y += yoff; // need to account for planet centre maxplanetpos = new Point(maxplanetpos.X + xoff, maxplanetpos.Y + yoff); // remove the shift from maxpos leftmiddle = new Point(maxplanetpos.X + planetspacerx, leftmiddle.Y + yoff); // and set the curpos to maxpos.x + spacer, remove the shift from curpos.y } else { leftmiddle = new Point(maxplanetpos.X + planetspacerx, leftmiddle.Y); // shift current pos right, plus a spacer } maxitemspos = new Point(Math.Max(maxitemspos.X, maxplanetpos.X), Math.Max(maxitemspos.Y, maxplanetpos.Y)); starcontrols.AddRange(pc.ToArray()); planetcentres[planetnode] = pcnt; } } // do any futher belts after all planets while (displaybelts && lastbelt != null) { if (leftmiddle.X + planetsize.Width > panelStars.Width - panelStars.ScrollBarWidth) // if too far across.. { leftmiddle = new Point(firstcolumn.X, maxitemspos.Y + planetspacery + planetsize.Height / 2); // move to left at maxy+space+h/2 } string appendlabel = ""; if (lastbelt.BeltData != null) { appendlabel = appendlabel.AppendPrePad($"{lastbelt.BeltData.OuterRad / JournalScan.oneLS_m:N1}ls", Environment.NewLine); } appendlabel = appendlabel.AppendPrePad("" + lastbelt.ScanData?.BodyID, Environment.NewLine); Point maxbeltpos = DrawNode(starcontrols, lastbelt, curmats, hl, Icons.Controls.Scan_Bodies_Belt, leftmiddle, false, out int unusedbelt2centre, beltsize, DrawLevel.PlanetLevel, appendlabeltext: appendlabel); leftmiddle = new Point(maxbeltpos.X + planetspacerx, leftmiddle.Y); lastbelt = belts.Count != 0 ? belts.Dequeue() : null; maxitemspos = new Point(Math.Max(maxitemspos.X, maxbeltpos.X), Math.Max(maxitemspos.Y, maxbeltpos.Y)); } maxitemspos = leftmiddle = new Point(leftmargin, maxitemspos.Y + starplanetgroupspacery + StarSize.Height / 2); // move back to left margin and move down to next position of star, allowing gap // make a tree of the planets with their barycentres from the Parents information var barynodes = StarScan.ScanNode.PopulateBarycentres(planetsinorder); // children always made, barynode tree StarScan.ScanNode.DumpTree(barynodes, "TOP", 0); List <ExtPictureBox.ImageElement> pcb = new List <ExtPictureBox.ImageElement>(); foreach (var k in barynodes.children) // for all barynodes.. display { DisplayBarynode(k.Value, 0, planetcentres, planetsinorder, pcb, planetsize.Height / 2); // done after the reposition so true positions set up. } starcontrols.InsertRange(0, pcb); // insert at start so drawn under } else { // no planets, so just move across and plot another one leftmiddle = new Point(maxitemspos.X + starfirstplanetspacerx, leftmiddle.Y); if (leftmiddle.X + StarSize.Width > panelStars.Width - panelStars.ScrollBarWidth) // if too far across.. { maxitemspos = leftmiddle = new Point(leftmargin, maxitemspos.Y + starplanetgroupspacery + StarSize.Height / 2); // move to left at maxy+space+h/2 } } DisplayAreaUsed = new Point(Math.Max(DisplayAreaUsed.X, maxitemspos.X), Math.Max(DisplayAreaUsed.Y, maxitemspos.Y)); } imagebox.AddRange(starcontrols); } imagebox.Render(); // replaces image.. }
void DrawSystem() // draw last_sn, last_he { dataGridViewScangrid.Rows.Clear(); dataGridViewScangrid.Refresh(); if (last_he == null) { SetControlText("No Scan"); return; } StarScan.SystemNode last_sn = discoveryform.history.starscan.FindSystem(last_he.System, true); SetControlText((last_sn == null) ? "No Scan" : ("Brief Scan Summary for " + last_sn.system.name)); if (last_sn != null) { List <StarScan.ScanNode> all_nodes = new List <StarScan.ScanNode>(); foreach (StarScan.ScanNode starnode in last_sn.starnodes.Values) { all_nodes = Flatten(starnode, all_nodes); } // flatten tree of scan nodes to prepare for listing foreach (StarScan.ScanNode sn in all_nodes) { if (sn.ScanData != null && sn.ScanData.BodyName != null) { StringBuilder bdClass = new StringBuilder(); StringBuilder bdDist = new StringBuilder(); StringBuilder bdDetails = new StringBuilder(); if (sn.ScanData.PlanetClass != null) { bdClass.Append(sn.ScanData.PlanetClass); } if (sn.ScanData.StarTypeText != null) { bdClass.Append(sn.ScanData.StarTypeText); } if (sn.level >= 2 && sn.type == StarScan.ScanNodeType.body) { bdClass.Append(" Moon"); } if (sn.ScanData.IsStar && sn.ScanData.BodyName.EndsWith(" A")) { bdDist.AppendFormat("Main Star"); } else if (sn.ScanData.nSemiMajorAxis.HasValue) { if (sn.ScanData.IsStar || sn.ScanData.nSemiMajorAxis.Value > JournalScan.oneAU_m / 10) { bdDist.AppendFormat("{0:0.00}AU ({1:0.00}ls)", (sn.ScanData.nSemiMajorAxis.Value / JournalScan.oneAU_m), sn.ScanData.nSemiMajorAxis.Value / JournalScan.oneLS_m); } else { bdDist.AppendFormat("{0}km", (sn.ScanData.nSemiMajorAxis.Value / 1000).ToString("N1")); } } // display stars and stellar bodies mass if (sn.ScanData.IsStar && sn.ScanData.nStellarMass.HasValue) { bdDetails.Append("Mass:" + sn.ScanData.nStellarMass.Value.ToString("N2") + ", "); } // habitable zone for stars - do not display for black holes. if (sn.ScanData.HabitableZoneInner != null && sn.ScanData.HabitableZoneOuter != null && sn.ScanData.StarTypeID != EDStar.H) { bdDetails.AppendFormat("Habitable Zone: {0}-{1}AU ({2})", (sn.ScanData.HabitableZoneInner.Value / JournalScan.oneAU_LS).ToString("N2"), (sn.ScanData.HabitableZoneOuter.Value / JournalScan.oneAU_LS).ToString("N2"), sn.ScanData.GetHabZoneStringLs() + " "); } // append the terraformable state to the planet class if (sn.ScanData.Terraformable == true) { bdDetails.Append("Terraformable. "); } // tell us that a bodie is landable, and shows its gravity if (sn.ScanData.IsLandable == true) { string Gg = ""; if (sn.ScanData.nSurfaceGravity.HasValue) { double?g = sn.ScanData.nSurfaceGravity / JournalScan.oneGee_m_s2; Gg = " (G: " + g.Value.ToString("N1") + ")"; } bdDetails.Append("Landable" + Gg + ". "); } // have some ring? if (sn.ScanData.HasRings && sn.ScanData.IsStar == false) { if (sn.ScanData.Rings.Count() > 1) { bdDetails.Append("Has " + sn.ScanData.Rings.Count() + " rings. "); } else { bdDetails.Append("Has 1 ring. "); } for (int i = 0; i < sn.ScanData.Rings.Length; i++) { string RingName = sn.ScanData.Rings[i].Name; bdDetails.Append(JournalScan.StarPlanetRing.DisplayStringFromRingClass(sn.ScanData.Rings[i].RingClass) + " "); bdDetails.Append((sn.ScanData.Rings[i].InnerRad / JournalScan.oneLS_m).ToString("N2") + "ls to " + (sn.ScanData.Rings[i].OuterRad / JournalScan.oneLS_m).ToString("N2") + "ls "); } } // tell us that there is some volcanic activity if (sn.ScanData.Volcanism != null) { bdDetails.Append("Volcanism. "); } // print the main atmospheric composition if (sn.ScanData.Atmosphere != null && sn.ScanData.Atmosphere != "None") { bdDetails.Append(sn.ScanData.Atmosphere + ". "); } int value = sn.ScanData.EstimatedValue; bdDetails.Append("Value " + value.ToString("N0")); Image img = null; if (sn.ScanData.IsStar == true) { img = sn.ScanData.GetStarTypeImage(); // if is a star, use the Star image } else { img = sn.ScanData.GetPlanetClassImage(); // use the correct image in case of planets and moons } dataGridViewScangrid.Rows.Add(new object[] { null, sn.ScanData.BodyName, bdClass, bdDist, bdDetails }); DataGridViewRow cur = dataGridViewScangrid.Rows[dataGridViewScangrid.Rows.Count - 1]; string scan = sn.ScanData.DisplayString(); // display tooltip with full information when hower bodies image and name cur.Cells[0].ToolTipText = scan; cur.Cells[1].ToolTipText = scan; cur.Tag = img; } } } }
private void BuildSystemInfo(StarScan.SystemNode system) { //systems are small... if they get too big and iterating repeatedly is a problem we'll have to move to a node-by-node approach, and move away from a single-line label lblSystemInfo.Text = BuildScanValue(system); }
private async void DrawSystem(HistoryEntry he, bool force) { var samesys = last_he?.System != null && he?.System != null && he.System.Name == last_he.System.Name; //System.Diagnostics.Debug.WriteLine("Scan grid " + samesys + " F:" + force); StarScan.SystemNode scannode = null; if (he == null) // no he, no display { last_he = he; dataGridViewScangrid.Rows.Clear(); SetControlText("No Scan".T(EDTx.NoScan)); return; } else { scannode = await discoveryform.history.StarScan.FindSystemAsync(he.System, checkBoxEDSM.Checked); // get data with EDSM maybe if (scannode == null) // no data, clear display, clear any last_he so samesys is false next time { last_he = null; dataGridViewScangrid.Rows.Clear(); SetControlText("No Scan".T(EDTx.NoScan)); return; } if (samesys && !force) // same system, no force, no redisplay { return; } } last_he = he; // only record first row if same system var firstdisplayedrow = (dataGridViewScangrid.RowCount > 0 && samesys) ? dataGridViewScangrid.SafeFirstDisplayedScrollingRowIndex() : -1; toolStripJumponiumProgressBar.Visible = false; toolStripJumponiumProgressBar.Value = 0; // reset the jumponium progress dataGridViewScangrid.RowTemplate.MinimumHeight = Font.ScalePixels(64); // based on icon size bodysize = dataGridViewScangrid.RowTemplate.MinimumHeight; iconsize = bodysize / 4; dataGridViewScangrid.Rows.Clear(); var all_nodes = scannode.Bodies.ToList(); // flatten tree of scan nodes to prepare for listing var stars = 0; var planets = 0; var terrestrial = 0; var gasgiants = 0; var moons = 0; List <MaterialCommodityMicroResource> historicmcl = discoveryform.history.MaterialCommoditiesMicroResources.Get(last_he.MaterialCommodity); List <MaterialCommodityMicroResource> curmcl = discoveryform.history.MaterialCommoditiesMicroResources.GetLast(); HashSet <string> jumponiums = new HashSet <string>(); foreach (StarScan.ScanNode sn in all_nodes) { // define strings to be populated var bdClass = new StringBuilder(); var bdDist = new StringBuilder(); var bdDetails = new StringBuilder(); if (sn.NodeType == StarScan.ScanNodeType.ring) { // do nothing, by now } else if (sn.NodeType == StarScan.ScanNodeType.beltcluster) { // if have a scan, we show belts, and its not edsm body, or getting edsm if (sn.ScanData?.BodyName != null && IsSet(CtrlList.showBelts) && (!sn.ScanData.IsEDSMBody || checkBoxEDSM.Checked)) { bdClass.Clear(); bdClass.Append("Belt Cluster"); if (sn.ScanData.ScanType == "Detailed") { bdDetails.Append("Scanned"); } else { bdDetails.Append("No scan data available"); } if (Math.Abs(sn.ScanData.DistanceFromArrivalLS) > 0) { bdDist.AppendFormat("{0:0.00}AU ({1:0.0}ls)", sn.ScanData.DistanceFromArrivalLS / JournalScan.oneAU_LS, sn.ScanData.DistanceFromArrivalLS); } var img = global::EDDiscovery.Icons.Controls.Belt; dataGridViewScangrid.Rows.Add(new object[] { null, sn.ScanData.BodyDesignationOrName, bdClass, bdDist, bdDetails }); var cur = dataGridViewScangrid.Rows[dataGridViewScangrid.Rows.Count - 1]; cur.Tag = img; cur.Cells[0].Tag = null; cur.Cells[4].Tag = cur.Cells[0].ToolTipText = cur.Cells[1].ToolTipText = cur.Cells[2].ToolTipText = cur.Cells[3].ToolTipText = cur.Cells[4].ToolTipText = sn.ScanData.DisplayString(0, historicmcl, curmcl); } } // must have scan data and a name to be good, and either not edsm body or edsm check else if (sn.ScanData?.BodyName != null && (!sn.ScanData.IsEDSMBody || checkBoxEDSM.Checked)) { var overlays = new StarColumnOverlays(); if (sn.ScanData.IsStar) { // is a star, so populate its information field with relevant data stars++; // star class if (sn.ScanData.StarTypeText != null) { bdClass.Append(sn.ScanData.StarTypeText); } // is the main star? if (sn.ScanData.BodyName.EndsWith(" A", StringComparison.Ordinal)) { bdDist.AppendFormat("Main Star".T(EDTx.UserControlScanGrid_MainStar)); } // if not, then tell us its hierarchy leveland distance from main star else if (sn.ScanData.nSemiMajorAxis.HasValue) { if (sn.ScanData.IsStar || sn.ScanData.nSemiMajorAxis.Value > JournalScan.oneAU_m / 10) { bdDist.AppendFormat("{0:0.00}AU ({1:0.00}ls)", (sn.ScanData.nSemiMajorAxis.Value / JournalScan.oneAU_m), sn.ScanData.nSemiMajorAxis.Value / JournalScan.oneLS_m); } else { bdDist.AppendFormat("{0}km", (sn.ScanData.nSemiMajorAxis.Value / 1000).ToString("N1")); } } // display stellar bodies mass, in sols if (sn.ScanData.nStellarMass.HasValue) { bdDetails.Append("Mass".T(EDTx.UserControlScanGrid_Mass)).Append(": ").Append(sn.ScanData.nStellarMass.Value.ToString("N2")).Append(", "); } // display stellar bodies radius in sols if (sn.ScanData.nRadius.HasValue) { bdDetails.Append("Radius".T(EDTx.UserControlScanGrid_Radius)).Append(": ").Append((sn.ScanData.nRadius.Value / JournalScan.oneSolRadius_m).ToString("N2")).Append(", "); } // show the temperature if (sn.ScanData.nSurfaceTemperature.HasValue) { bdDetails.Append("Temperature".T(EDTx.UserControlScanGrid_Temperature)).Append(": ").Append((sn.ScanData.nSurfaceTemperature.Value)).Append("K."); } // habitable zone for stars - do not display for black holes. if (sn.ScanData.StarTypeID != EDStar.H) { if (IsSet(CtrlList.showHabitable)) { string hz = sn.ScanData.CircumstellarZonesString(false, JournalScan.CZPrint.CZHab); bdDetails.AppendFormat(Environment.NewLine + hz); } if (IsSet(CtrlList.showMetalRich)) { string hz = sn.ScanData.CircumstellarZonesString(false, JournalScan.CZPrint.CZMR); bdDetails.AppendFormat(Environment.NewLine + hz); } if (IsSet(CtrlList.showWaterWorlds)) { string hz = sn.ScanData.CircumstellarZonesString(false, JournalScan.CZPrint.CZWW); bdDetails.AppendFormat(Environment.NewLine + hz); } if (IsSet(CtrlList.showEarthLike)) { string hz = sn.ScanData.CircumstellarZonesString(false, JournalScan.CZPrint.CZEL); bdDetails.AppendFormat(Environment.NewLine + hz); } if (IsSet(CtrlList.showAmmonia)) { string hz = sn.ScanData.CircumstellarZonesString(false, JournalScan.CZPrint.CZAW); bdDetails.AppendFormat(Environment.NewLine + hz); } if (IsSet(CtrlList.showIcyBodies)) { string hz = sn.ScanData.CircumstellarZonesString(false, JournalScan.CZPrint.CZIP); bdDetails.AppendFormat(Environment.NewLine + hz); } } } else { // is a non-stellar body // is terraformable? If so, prepend it to the body class if (sn.ScanData.Terraformable) { bdClass.Append("Terraformable".T(EDTx.UserControlScanGrid_Terraformable)).Append(", "); } if (sn.NodeType == StarScan.ScanNodeType.body) // Planet, not barycenter/belt { bdClass.Append(sn.ScanData.PlanetTypeText); if (sn.Level <= 1) // top level planet { planets++; if (sn.ScanData.GasWorld) { gasgiants++; } else { terrestrial++; } bdDist.AppendFormat("{0:0.00}AU ({1:0.0}ls)", sn.ScanData.DistanceFromArrivalLS / JournalScan.oneAU_LS, sn.ScanData.DistanceFromArrivalLS); } else { moons++; bdClass.Append(" ").Append("Moon".T(EDTx.UserControlScanGrid_Moon)); // moon distances from center body are measured from in SemiMajorAxis if (sn.ScanData.nSemiMajorAxis.HasValue) { bdDist.AppendFormat("{0:0.0}ls ({1:0}km)", sn.ScanData.nSemiMajorAxis.Value / JournalScan.oneLS_m, sn.ScanData.nSemiMajorAxis.Value / 1000); } } } // Details // display non-stellar bodies radius in earth radiuses if (sn.ScanData.nRadius.HasValue) { bdDetails.Append("Radius".T(EDTx.UserControlScanGrid_Radius)).Append(": ").Append((sn.ScanData.nRadius.Value / 1000.0).ToString("N0") + "km ("). Append((sn.ScanData.nRadius.Value / JournalScan.oneEarthRadius_m).ToString("N2")).Append("ER), "); } // show the temperature, both in K and C degrees if (sn.ScanData.nSurfaceTemperature.HasValue) { bdDetails.Append("Temperature".T(EDTx.UserControlScanGrid_Temperature)).Append(": ").Append((sn.ScanData.nSurfaceTemperature.Value).ToString("N2")).Append("K, (").Append((sn.ScanData.nSurfaceTemperature.Value - 273).ToString("N2")).Append("C)."); } // print the main atmospheric composition and pressure, if presents if (sn.ScanData.Atmosphere != "none") { bdDetails.Append(Environment.NewLine).Append(sn.ScanData.Atmosphere); if (sn.ScanData.nSurfacePressure.HasValue) { bdDetails.Append(", ").Append((sn.ScanData.nSurfacePressure.Value / JournalScan.oneAtmosphere_Pa).ToString("N3")).Append("Pa."); } } // tell us that a bodie is landable, and shows its gravity if (sn.ScanData.IsLandable) { var Gg = ""; if (sn.ScanData.nSurfaceGravity.HasValue) { var g = sn.ScanData.nSurfaceGravity / JournalScan.oneGee_m_s2; Gg = " (G: " + g.Value.ToString("N1") + ")"; } bdDetails.Append(Environment.NewLine).Append("Landable".T(EDTx.UserControlScanGrid_Landable)).Append(Gg).Append(". "); overlays.landable = true; } // tell us that there is some volcanic activity if (sn.ScanData.Volcanism.HasChars()) { bdDetails.Append(Environment.NewLine).Append("Geological activity".T(EDTx.UserControlScanGrid_Geologicalactivity)).Append(": ").Append(sn.ScanData.Volcanism).Append(". "); overlays.volcanism = true; } if (sn.ScanData.Mapped) { bdDetails.Append(Environment.NewLine).Append("Surface mapped".T(EDTx.UserControlScanGrid_Surfacemapped)).Append(". "); overlays.mapped = true; } if (sn.Organics != null) { string ol = JournalScanOrganic.OrganicList(sn.Organics); bdDetails.Append(Environment.NewLine).Append(ol); } // materials if (sn.ScanData.HasMaterials) { var ret = ""; foreach (KeyValuePair <string, double> mat in sn.ScanData.Materials) { var mc = MaterialCommodityMicroResourceType.GetByFDName(mat.Key); if (mc?.IsJumponium == true) { ret = ret.AppendPrePad(mc.Name, ", "); overlays.materials = true; } } if (ret.Length > 0 && IsSet(CtrlList.showMaterials)) { bdDetails.Append(Environment.NewLine).Append("This body contains: ".T(EDTx.UserControlScanGrid_BC)).Append(ret); } } } // have some belt, ring or other special structure? if (sn.ScanData.HasRings) { for (int r = 0; r < sn.ScanData.Rings.Length; r++) { if (sn.ScanData.Rings[r].Name.EndsWith("Belt", StringComparison.Ordinal)) { if (IsSet(CtrlList.showBelts)) { // is a belt bdDetails.Append(Environment.NewLine).Append("Belt: ".T(EDTx.UserControlScanGrid_Belt)); var RingName = sn.ScanData.Rings[r].Name; bdDetails.Append(JournalScan.StarPlanetRing.DisplayStringFromRingClass(sn.ScanData.Rings[r].RingClass)).Append(" "); bdDetails.Append((sn.ScanData.Rings[r].InnerRad / JournalScan.oneLS_m).ToString("N2")).Append("ls to ").Append((sn.ScanData.Rings[r].OuterRad / JournalScan.oneLS_m).ToString("N2")).Append("ls. "); } } else { if (IsSet(CtrlList.showRings)) { // is a ring bdDetails.Append(Environment.NewLine).Append("Ring: ".T(EDTx.UserControlScanGrid_Ring)); var RingName = sn.ScanData.Rings[r].Name; bdDetails.Append(JournalScan.StarPlanetRing.DisplayStringFromRingClass(sn.ScanData.Rings[r].RingClass)).Append(" "); bdDetails.Append((sn.ScanData.Rings[r].InnerRad / JournalScan.oneLS_m).ToString("N2")).Append("ls to ").Append((sn.ScanData.Rings[r].OuterRad / JournalScan.oneLS_m).ToString("N2")).Append("ls. "); } } } } // give estimated value if (IsSet(CtrlList.showValues)) { var value = sn.ScanData.EstimatedValue; bdDetails.Append(Environment.NewLine).Append("Value".T(EDTx.UserControlScanGrid_Value)).Append(" ").Append(value.ToString("N0")); } if (sn.ScanData.IsEDSMBody) { bdDetails.Append(Environment.NewLine).Append("EDSM"); } // pick an image Bitmap img = (Bitmap)BaseUtils.Icons.IconSet.GetIcon(sn.ScanData.GetStarPlanetTypeImageName()); dataGridViewScangrid.Rows.Add(new object[] { null, sn.ScanData.BodyDesignationOrName, bdClass, bdDist, bdDetails }); var cur = dataGridViewScangrid.Rows[dataGridViewScangrid.Rows.Count - 1]; cur.Tag = img; cur.Cells[0].Tag = overlays; cur.Cells[4].Tag = cur.Cells[0].ToolTipText = cur.Cells[1].ToolTipText = cur.Cells[2].ToolTipText = cur.Cells[3].ToolTipText = cur.Cells[4].ToolTipText = sn.ScanData.DisplayString(0, historicmcl, curmcl); sn.ScanData.Jumponium(jumponiums); // add to jumponiums hash any seen } } toolStripJumponiumProgressBar.Value = jumponiums.Count; toolStripJumponiumProgressBar.Visible = toolStripJumponiumProgressBar.Value > 0; //System.Diagnostics.Debug.WriteLine("Jumponiums " + toolStripJumponiumProgressBar.Value + " " + toolStripJumponiumProgressBar.Visible); if (toolStripJumponiumProgressBar.Value == 8) { toolStripJumponiumProgressBar.ToolTipText = "This is a green system, as it has all existing jumponium materials available!".T(EDTx.UserControlScanGrid_GS); } else { toolStripJumponiumProgressBar.ToolTipText = toolStripJumponiumProgressBar.Value + " jumponium materials found in system.".T(EDTx.UserControlScanGrid_JS); } string report = string.Format("Scan Summary for {0}: {1} stars; {2} planets ({3} terrestrial, {4} gas giants), {5} moons".T(EDTx.UserControlScanGrid_ScanSummaryfor), scannode.System.Name, stars, planets, terrestrial, gasgiants, moons); report = "~" + scannode.ScanValue(checkBoxEDSM.Checked).ToString() + " cr " + report; SetControlText(scannode.System.Name); toolStripStatusTotalValue.Text = report; if (firstdisplayedrow >= 0 && firstdisplayedrow < dataGridViewScangrid.RowCount) { dataGridViewScangrid.SafeFirstDisplayedScrollingRowIndex(firstdisplayedrow); } }
private async void OnNewEntry(HistoryEntry he, HistoryList hl) { last_he = he; if (last_he != null) { if (bodyRadius == null || lastradiusbody != he.WhereAmI) // try and get radius, this is cleared on target selection { StarScan.SystemNode last_sn = await discoveryform.history.StarScan.FindSystemAsync(he.System, false); // find scan if we have one JournalScan sd = last_sn?.Find(he.WhereAmI)?.ScanData; // find body scan data if present, null if not bodyRadius = sd?.nRadius; if (bodyRadius.HasValue) { lastradiusbody = he.WhereAmI; System.Diagnostics.Debug.WriteLine("Compass Radius Set " + lastradiusbody + " " + bodyRadius.Value); } } switch (he.journalEntry.EventTypeID) { case JournalTypeEnum.Screenshot: JournalScreenshot js = he.journalEntry as JournalScreenshot; latitude = js.nLatitude; longitude = js.nLongitude; altitude = js.nAltitude; break; case JournalTypeEnum.Touchdown: JournalTouchdown jt = he.journalEntry as JournalTouchdown; if (jt.PlayerControlled.HasValue && jt.PlayerControlled.Value) { latitude = jt.Latitude; longitude = jt.Longitude; altitude = 0; } break; case JournalTypeEnum.Location: JournalLocation jl = he.journalEntry as JournalLocation; latitude = jl.Latitude; longitude = jl.Longitude; altitude = null; break; case JournalTypeEnum.Liftoff: JournalLiftoff jlo = he.journalEntry as JournalLiftoff; if (jlo.PlayerControlled.HasValue && jlo.PlayerControlled.Value) { latitude = jlo.Latitude; longitude = jlo.Longitude; altitude = 0; } break; case JournalTypeEnum.LeaveBody: latitude = null; longitude = null; altitude = null; break; case JournalTypeEnum.FSDJump: // to allow us to do PopulateBookmark.. case JournalTypeEnum.CarrierJump: break; default: return; } PopulateBookmarkCombo(); DisplayCompass(); } }
string Infoline(ISystem system, StarScan.SystemNode sysnode) { string infostr = ""; 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 = ""; string jumponium = ""; foreach (StarScan.ScanNode sn in sysnode.Bodies) { string bodyinfo = ""; if (sn.ScanData != null && checkBoxBodyClasses.Checked) { JournalScan sc = sn.ScanData; string bodynameshort = sc.BodyName.ReplaceIfStartsWith(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, collect into jumponimum if (sn.ScanData != null && sn.ScanData.IsLandable == true && sn.ScanData.HasMaterials && checkBoxJumponium.Checked == 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 (jumponium.HasChars()) { infostr = infostr.AppendPrePad(Environment.NewLine + Environment.NewLine + "This system has materials for FSD boost: ".T(EDTx.UserControlStarList_FSD)); infostr = infostr.AppendPrePad(jumponium); } } } return(infostr); }
string Infoline(List <HistoryEntry> syslist) { string infostr = ""; if (syslist.Count > 1) { infostr = "First visit " + syslist.Last().EventTimeLocal.ToShortDateString(); } HistoryEntry he = syslist[0]; StarScan.SystemNode node = discoveryform.history.starscan?.FindSystem(he.System); if (node != null) { if (node.starnodes != null) { infostr = infostr.AppendPrePad(node.starnodes.Count.ToStringInvariant() + " Star" + ((node.starnodes.Count > 1) ? "s" : ""), Environment.NewLine); string extrainfo = ""; string prefix = Environment.NewLine; int total = 0; foreach (StarScan.ScanNode sn in node.Bodies) { total++; if (sn.ScanData != null) { JournalScan sc = sn.ScanData; 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) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is a super massive black hole", prefix); } // black holes if (sc.StarTypeID == EDStar.H) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is a black hole", prefix); } // neutron stars if (sc.StarTypeID == EDStar.N) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is a neutron star", 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)) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is a " + sc.StarTypeID + " white dwarf star", prefix); } // wolf rayet (W, WN, WNC, WC, WO) string WolfRayet = "Wolf-Rayet"; if (sc.StarTypeText.Contains(WolfRayet)) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is a " + sc.StarTypeID + " wolf-rayet star", prefix); } // giants. It should recognize all classes of giants. string Giant = "Giant"; if (sc.StarTypeText.Contains(Giant)) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is a " + sc.StarTypeText, prefix); } // rogue planets - not sure if they really exists, but they are in the journal, so... if (sc.StarTypeID == EDStar.RoguePlanet) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is a rogue planet", 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) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is an earth like moon", prefix); } // Terraformable water moon if (sc.Terraformable == true && sc.PlanetTypeID == EDPlanet.Water_world) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is a terraformable water moon", prefix); } // Water moon if (sc.Terraformable == false && sc.PlanetTypeID == EDPlanet.Water_world) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is a water moon", prefix); } // Terraformable moon if (sc.Terraformable == true && sc.PlanetTypeID != EDPlanet.Water_world) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is a terraformable moon", prefix); } // Ammonia moon if (sc.PlanetTypeID == EDPlanet.Ammonia_world) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is an ammonia moon", prefix); } } else // Do the same, for all planets { // Earth Like planet if (sc.PlanetTypeID == EDPlanet.Earthlike_body) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is an earth like planet", prefix); } // Terraformable water world if (sc.PlanetTypeID == EDPlanet.Water_world && sc.Terraformable == true) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is a terraformable water world", prefix); } // Water world if (sc.PlanetTypeID == EDPlanet.Water_world && sc.Terraformable == false) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is a water world", prefix); } // Terraformable planet if (sc.Terraformable == true && sc.PlanetTypeID != EDPlanet.Water_world) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is a terraformable planet", prefix); } // Ammonia world if (sc.PlanetTypeID == EDPlanet.Ammonia_world) { extrainfo = extrainfo.AppendPrePad(sc.BodyName + " is an ammonia world", prefix); } } } } } total -= node.starnodes.Count; if (total > 0) { // tell us that a system has other bodies, and how much, beside stars infostr = infostr.AppendPrePad(total.ToStringInvariant() + " Other bod" + ((total > 1) ? "ies" : "y"), ", "); 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); } } } return(infostr); }