Exemple #1
0
        // get the sale price info
        private void btnSell_Click(object sender, EventArgs e)
        {
            int DM = 0;
            int.TryParse(edDM.Text, out DM);

            Traveller.Trade trade = new Traveller.Trade(ship, world);
            cargo = trade.sell(cargo, world, DM);
            lblSellAt.Text = String.Format("{0} [actual value: {1}%]", cargo.sellingPrice.ToString(),
                cargo.avSell* 100.00);
        }
Exemple #2
0
        /// <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());
            }
        }