private void Display(ShipInformation si) { foreach (string key in si.Modules.Keys) { EliteDangerousCore.JournalEvents.JournalLoadout.ShipModule sm = si.Modules[key]; string ammo = ""; if (sm.AmmoHopper.HasValue) { ammo = sm.AmmoHopper.Value.ToString(); if (sm.AmmoClip.HasValue) { ammo += "/" + sm.AmmoClip.ToString(); } } string value = (sm.Value.HasValue && sm.Value.Value > 0) ? sm.Value.Value.ToString(System.Globalization.CultureInfo.InvariantCulture) : ""; string eng = ""; if (sm.Engineering != null) { eng = sm.Engineering.FriendlyBlueprintName; } object[] rowobj = { sm.Slot, sm.Item, sm.LocalisedItem.ToNullSafeString(), ammo, eng, value, sm.PE() }; // debug object[] rowobj = { sm.Slot+":" + sm.SlotFD, sm.Item + ":" + sm.ItemFD, sm.LocalisedItem.ToNullSafeString() , ammo, blueprint , value, sm.PE() }; dataGridViewModules.Rows.Add(rowobj); } LabelVehicleText.Visible = labelVehicle.Visible = true; labelVehicle.Text = si.ShipFullInfo(); buttonExtCoriolis.Visible = si.CheckMinimumJSONModules(); }
private void DisplayShip(ShipInformation si) { //System.Diagnostics.Debug.WriteLine("HE " + last_he.Indexno); last_si = si; foreach (string key in si.Modules.Keys) { EliteDangerousCore.ShipModule sm = si.Modules[key]; AddModuleLine(sm); } double hullmass = si.HullMass(); double modulemass = si.ModuleMass(); EliteDangerousCalculations.FSDSpec fsdspec = si.GetFSDSpec(); if (fsdspec != null) { EliteDangerousCalculations.FSDSpec.JumpInfo ji = fsdspec.GetJumpInfo(0, modulemass + hullmass, si.FuelCapacity, si.FuelCapacity / 2); AddInfoLine("FSD Avg Jump".T(EDTx.UserControlModules_FSDAvgJump), ji.avgsinglejumpnocargo.ToString("N2") + "ly", "Half tank, no cargo".T(EDTx.UserControlModules_HT), fsdspec.ToString()); DataGridViewRow rw = dataGridViewModules.Rows[dataGridViewModules.Rows.Count - 1]; AddInfoLine("FSD Max Range".T(EDTx.UserControlModules_FSDMaxRange), ji.maxjumprange.ToString("N2") + "ly", "Full Tank, no cargo".T(EDTx.UserControlModules_FT), fsdspec.ToString()); AddInfoLine("FSD Maximum Fuel per jump".T(EDTx.UserControlModules_FSDMaximumFuelperjump), fsdspec.MaxFuelPerJump.ToString() + "t", "", fsdspec.ToString()); } if (si.HullValue > 0) { AddValueLine("Hull Value".T(EDTx.UserControlModules_HullValue), si.HullValue); } if (si.ModulesValue > 0) { AddValueLine("Modules Value".T(EDTx.UserControlModules_ModulesValue), si.ModulesValue); } if (si.HullValue > 0 && si.ModulesValue > 0) { AddValueLine("Total Cost".T(EDTx.UserControlModules_TotalCost), si.HullValue + si.ModulesValue); } if (si.Rebuy > 0) { AddValueLine("Rebuy Cost".T(EDTx.UserControlModules_RebuyCost), si.Rebuy); } AddMassLine("Mass Hull".T(EDTx.UserControlModules_MassHull), hullmass.ToString("N1") + "t"); AddMassLine("Mass Unladen".T(EDTx.UserControlModules_MassUnladen), (hullmass + modulemass).ToString("N1") + "t"); if (si.UnladenMass > 0) { AddMassLine("Mass FD Unladen".T(EDTx.UserControlModules_MassFDUnladen), si.UnladenMass.ToString("N1") + "t"); } AddMassLine("Mass Modules".T(EDTx.UserControlModules_MassModules), modulemass.ToString("N1") + "t"); AddInfoLine("Manufacturer".T(EDTx.UserControlModules_Manufacturer), si.Manufacturer); if (si.FuelCapacity > 0) { AddInfoLine("Fuel Capacity".T(EDTx.UserControlModules_FuelCapacity), si.FuelCapacity.ToString("N1") + "t"); } if (si.FuelLevel > 0) { AddInfoLine("Fuel Level".T(EDTx.UserControlModules_FuelLevel), si.FuelLevel.ToString("N1") + "t"); } if (si.ReserveFuelCapacity > 0) { AddInfoLine("Fuel Reserve Capacity".T(EDTx.UserControlModules_FuelReserveCapacity), si.ReserveFuelCapacity.ToString("N2") + "t"); } if (si.HullHealthAtLoadout > 0) { AddInfoLine("Hull Health (Loadout)".T(EDTx.UserControlModules_HullHealth), si.HullHealthAtLoadout.ToString("N1") + "%"); } double fuelwarn = si.FuelWarningPercent; AddInfoLine("Fuel Warning %".T(EDTx.UserControlModules_FuelWarning), fuelwarn > 0 ? fuelwarn.ToString("N1") + "%" : "Off".T(EDTx.Off)); AddInfoLine("Pad Size".T(EDTx.UserControlModules_PadSize), si.PadSize); AddInfoLine("Main Thruster Speed".T(EDTx.UserControlModules_MainThrusterSpeed), si.Speed.ToString("0.#")); AddInfoLine("Main Thruster Boost".T(EDTx.UserControlModules_MainThrusterBoost), si.Boost.ToString("0.#")); if (si.InTransit) { AddInfoLine("In Transit to ".T(EDTx.UserControlModules_InTransitto), (si.StoredAtSystem ?? "Unknown".T(EDTx.Unknown)) + ":" + (si.StoredAtStation ?? "Unknown".T(EDTx.Unknown))); } else if (si.StoredAtSystem != null) { AddInfoLine("Stored at".T(EDTx.UserControlModules_Storedat), si.StoredAtSystem + ":" + (si.StoredAtStation ?? "Unknown".T(EDTx.Unknown))); } int cc = si.CargoCapacity(); if (cc > 0) { AddInfoLine("Cargo Capacity".T(EDTx.UserControlModules_CargoCapacity), cc.ToString("N0") + "t"); } labelVehicle.Visible = true; labelVehicle.Text = si.ShipFullInfo(cargo: false, fuel: false); buttonExtConfigure.Visible = true; buttonExtCoriolis.Visible = buttonExtEDShipyard.Visible = si.CheckMinimumJSONModules(); }