I have been depending on the TravellerMap API to have the trade code classifications in the Remarks field. While this does work, I'd rather have a more nuanced approach to have more details.
I already have the trade code table which gives you trade codes based on the UWP characteristics. I've added a function to get that list of trade codes based on UWP. Had an issue with nulls but I'll update the DB to not allow nulls for the list of statistics, and that should correct it.
Since I am having to wipe my DB clean again (SQLite migrations do not support changing column attributes, the adding 'not nullable') I'll also expand out the seed that imports the trade codes to include all of them (I manually entered them for testing, found the null issue, and do not want to manually enter them all over again! Although a fix would be to initialize the new classification with blanks, I'd rather have the DB enforce that). This will still allow users to add their own trade codes if they want, and the T5 trade code generator will pick random goods based on trade codes, so that will allow for that to work. It won't affect Classic as that has a very restricted list.
The code to grab the list of trade classifications is pretty simple after the fact. What I've yet to figure out is how to add additional, non-UWP derived trade codes to a world (i.e., Capitol). I'll probably add a new table for non-UWP trade classifications to allow for the manual entry, and combine those two lists in the new function.
Listresults = App.DB.TradeClassifications.Where(x => x.Sizes.Length == 0 || x.Sizes.Contains(Size)).
Where(x => x.Atmospheres.Length == 0 || x.Atmospheres.Contains(Atmosphere)).
Where(x => x.Hydro.Length == 0 || x.Hydro.Contains(Hydro)).
Where(x => x.Pop.Length == 0 || x.Pop.Contains(Population)).
Where(x => x.Gov.Length == 0 || x.Gov.Contains(Gov)).
Where(x =>x.Law.Length == 0 || x.Law.Contains(Law)).ToList();
No comments:
Post a Comment