public DisplayWorld(Traveller.World world) { InitializeComponent(); this.world = world; lblSEC.Text = world.SEC; lblWorld.Text = world.Name; this.Text = "System Data for " + world.Name; showData(world); }
/// <summary> /// selling a cargo lot /// </summary> /// <param name="cargo">cargo structure - item we are selling</param> /// <param name="ship">Traveller starship - ship it is being sold from</param> /// <param name="world">Traveller world - world it is being sold on</param> public Selling(Traveller.Starship.cargoDesc cargo, Traveller.Starship ship, Traveller.World world) { InitializeComponent(); lblCurrent.Text = world.SEC; lblSelling.Text = String.Format("{0} {1} dTons; Cr{2}", cargo.origCode, cargo.dtons, cargo.purchasePrice); lblDesc.Text = cargo.desc; lblOrigSystem.Text = cargo.origSEC; edDM.Text = ship.TradeDM.ToString(); this.world = world; this.cargo = cargo; this.ship = ship; // and set the selling info this.cargo.sellingDate = this.ship.Date; this.cargo.destSEC = this.world.SEC; }
public void makeJump(string secString) { // 1st see if we've a world already loaded, and save off any notes if (edNotes.Text.Length > 0) { world.saveNotes(edNotes.Text, edNPC.Text); } // our jump from travelogue if (world != null) { ship.travelogue("Prepping for jumping from " + world.Name); } // 1st see if we're in jump range Traveller.World newWorld = new Traveller.World(); if (newWorld.isValidSEC(secString)) { newWorld = new Traveller.World(secString, ship.Version); if (world == null) { world = newWorld; } Traveller.TravUtils util = new Traveller.TravUtils(); if (util.calcDistance(newWorld.Hex, world.Hex) <= ship.Jump) { ship.makeJump(secString); world = new Traveller.World(secString, ship.Version); showShip(ship.Filename); } else { MessageBox.Show("You can't jump that far!"); } } else { MessageBox.Show(secString, "Invalid SEC format"); } }
private void loadDataFile(string filename) { // and load our world picker cbWorld.Items.Clear(); StreamReader rd = new StreamReader(filename); string line = ""; Traveller.World tw = new Traveller.World(); while ((line = rd.ReadLine()) != null) { if (tw.isValidSEC(line)) { cbWorld.Items.Add(line); } } }
/// <summary> /// trade instantiation /// </summary> /// <param name="ship">ship - Traveller ship object</param> /// <param name="world">world - Traveller world object</param> /// <remarks>deals with cargo</remarks> public Trade(Traveller.Starship ship, Traveller.World w) { this.errmsg = ""; this.world = w; this.ship = ship; this.cargoes = new List<Starship.cargoDesc>(); this.version = ship.Version; }
public AddWorldImage(Traveller.World world) { InitializeComponent(); this.Text = "add image to " + world.Name; this.myworld = world; }
private void showSystemToolStripMenuItem_Click(object sender, EventArgs e) { if (cbWorlds.SelectedText.Length > 0) { Traveller.World dw = new Traveller.World(cbWorlds.SelectedText, ship.Version); DisplayWorld dispworld = new DisplayWorld(dw); dispworld.frm1 = this; dispworld.ShowDialog(); } }
/// <summary> /// generate the list of J6 worlds and their expected base value /// </summary> private void reportJ6Trade() { // 1st, we need a cargo code from the current world Traveller.Trade trade = new Traveller.Trade(ship, world); Traveller.Starship.cargoDesc origCargo = trade.findCargo()[0]; List<string> codes = new List<string>(); codes.Add(String.Format("Selling from {0} [{1}] Cargo Origin Code: {2}", world.Name, world.Hex, origCargo.origCode)); codes.Add(" "); foreach (ListViewItem lvi in lvJ6.Items) { try { Traveller.World tw = new Traveller.World(lvi.Text, ship.Version); trade = new Traveller.Trade(ship, tw); origCargo = trade.sell(origCargo, tw, 0); string cc = String.Format("{0,-20} {1} [{2}] Cr{3}", tw.Name, tw.UWP, tw.Hex, origCargo.basecostsell); codes.Add(cc); } catch (Exception ex) { codes.Add("Error on line: " + lvi.Text + ": " + ex.Message); } } SaveFileDialog sv = new SaveFileDialog(); if (sv.ShowDialog() == DialogResult.OK) { File.WriteAllLines(sv.FileName, codes.ToArray()); } }
/// <summary> /// generate a report of all trade codes /// </summary> private void reportAllCodes() { List<string> codes = new List<string>(); foreach (string line in cbWorlds.Items) { try { Traveller.World tw = new Traveller.World(line, ship.Version); Traveller.Trade trade = new Traveller.Trade(ship, tw); List<Traveller.Starship.cargoDesc> cargoes = trade.findCargo(); string cc = String.Format("{0,-25} {1} [{2}] {3}", tw.Name, tw.UWP, tw.Hex, cargoes[0].origCode); codes.Add(cc); } catch (Exception ex) { codes.Add("Error on line: " + line + ": " + ex.Message); } } SaveFileDialog sv = new SaveFileDialog(); if (sv.ShowDialog() == DialogResult.OK) { File.WriteAllLines(sv.FileName, codes.ToArray()); } }
// show the system clicked private void lvJ6_MouseDoubleClick(object sender, MouseEventArgs e) { string sec = lvJ6.SelectedItems[0].Text; Traveller.World dw = new Traveller.World(sec, ship.Version); DisplayWorld dispworld = new DisplayWorld(dw); dispworld.frm1 = this; dispworld.ShowDialog(); }
private void loadSector() { // clear out anything if we've got it cbWorlds.Items.Clear(); // and load the sector file StreamReader rd = new StreamReader("Assets/" + ship.SECDataFile); string line = ""; Traveller.World tw = new Traveller.World(); while ((line = rd.ReadLine()) != null) { if (tw.isValidSEC(line)) { cbWorlds.Items.Add(line); } } }
// actually show the ship data private void displayShip() { string[] filename = ship.Filename.Split(new char[] { '/' }); lblShipFileName.Text = filename[filename.Length - 1]; lblShipName.Text = ship.Name; lblManPowJump.Text = String.Format("Man: {0}; Power: {1}; Jump: {2}", ship.Man, ship.Power, ship.Jump); lblCargo.Text = String.Format("Total tonnage: {0}; Current cargo: {1}; Avail: {2}", ship.Cargo, ship.CargoHeld, ship.Cargo - ship.CargoHeld); lblCredits.Text = ship.Credits.ToString(); sbCredits.Text = "Current credits: Cr" + ship.Credits.ToString(); showCargo(ship.Manifest); showSold(ship.Sold); // set the version switch (ship.Version) { case "CT": sbVersion.Text = "Classic Traveller"; break; case "MT": sbVersion.Text = "Mongoose Traveller"; break; case "T5": sbVersion.Text = "T5 Traveller"; break; case "CU": sbVersion.Text = "Custom Traveller"; break; default: break; } showDate(); showTravelogue(); if (ship.SEC.Length > 0) { world = new Traveller.World(ship.SEC, ship.Version); showWorld(world); } }