Saturday, November 04, 2017

Traveller Tracker - Jump map, trade class editor

Finished up the trade code editor, complete with a delete option. Although I will probably put all the basic codes into the seed class to have them out of the box.  I still need to add a matrix of how the trade codes affect trade (buy, sell, availability). This is pretty much version dependent so I need to figure a way to allow the eventual users the ability to edit this (huh, maybe I am designing an EHR all over again!)

I also finally got the jump map display to work (thanks TravellerMap!) The code is pretty straight forward - pass in the world object & the jump range and you get a URL back.  I do have to replace all spaces with %20.  Now that I am thinking about it, I could just return a proper Uri instead of a string...next commit!

        public string JumpMapURL(World w, int jump)
        {
            string sector = App.DB.Sectors.Where(x => x.SectorID == w.SectorID).FirstOrDefault().Name.Replace(" ", "%20");
            return  string.Format("Https://travellermap.com/api/jumpmap?sector={0}&hex={1}&jump={2}", sector, w.Hex, jump);
        }


I also return the trade code in alphabetical order based on the 2 character code.  

I can generate the list of worlds within jump range from the downloaded worlds (I cache all sectors & worlds you load in the local DB, and I've code to figure out the worlds based on the hex position).

Still need to plumb in the buttons for searching for cargo, but first I have to figure that part out. And a cargo editor.





No comments: