Sunday, November 12, 2017

Traveller Tracker - cargo v1

I've seeded the DB with the book 2 cargos, and have an initial draft not yet in place. Part of this is also having a cargo editor.  I've the cargo list going, but also realize I may have to end up putting in a search function as well - T5 has perhaps hundreds of cargos.

The cargo class itself is a blend of the various versions.  I'm concentrating on Classic at the moment until I get that working.

If there were interest, I'd actually open up a Trello board or something to allow potential users a voice in where this is going. And as previously mentioned the source code is on my GitHub account with an open source license.  If anyone is interested in running this locally (Windows 10 only, sorry!) let me know & I can add an entry on how to do all that (clone the repo, install the tools, run the thing).

I also had to reset the migrations again: I misnamed a column in the cargo table, and renaming columns is not supported for SQLite / Entity Framework. Darn.

Cargo definition at the moment:

   public class Cargo
    {
        public int CargoID { get; set; }
        public int dTons { get; set; }
        public int BasePurchasePrice { get; set; }
        public string CargoCode { get; set; }
        public string Description { get; set; }
        // FK to CargoType
        public int CargoTypeId { get; set; }
        public int TravellerVersionId { get; set; }  // which version of Traveller this belongs to; 0 = all
        // version specific items
        // classic d66 table
        public int D1 { get; set; }
        public int D2 { get; set; }
        public int QtyDie { get; set; }
        public int Multiplier { get; set; }
        public string GetCargoType()
        {
            if (CargoTypeId > 0)
                return TravellerTracker.App.DB.CargoTypes.Where(x => x.CargoTypeId == CargoTypeId).FirstOrDefault().Description;
            else
                return "n/a";
        }
        [NotMapped]
        public string ListDesc => string.Format("[{0} {1}] {2}", D1, D2, Description);
    }







No comments: