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 = ""; } } }
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(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); }