Giter Site home page Giter Site logo

xwingtmg2-inventory-rs's Introduction

X-Wing: The Miniature Game 2.0/2.5 Inventory Management Tools

This repository generates an Microsoft® Excel® for Microsoft 365 MSO for keeping track of an X-Wing: The Miniature Game 2.0/2.5 collection.

As a command line interface (CLI), it gives you the ability to take your raw yasb collection and dump it to a json file that can be further processed with something jq.

Using the produced spreadsheet

  1. Download the latest spreadsheet from the Releases.
  2. In the Expansions sheet, input the number of each expansion you own in the Owned column.
  3. In the other sheets, Ships, Pilots, Upgrades, add any loose ships, such as 1.0 models still in your collection to the Singles column.

That's it. The Totals column will update with your Singles and Expansion counts per-item summed.

Using the CLI directly with a YASB collection

  1. You will need a working rust toolchain. Refer to the installation and usage instructions for your platform.
  2. Clone this repo and its submodules: git submodule init.
  3. Log in to https://yasb.app, access your raw collection at https://login.yasb.app/collection, and save the json to collection.json.
  4. Run the tool with cargo run. This will produce an inventory.json, which will contain ships, pilots, and upgrades lists.
  5. Use something like jq to turn it into CSV (from StackOverflow):
cargo run -- --format json --collection collection.json
jq -r '.pilots | (map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv' inventory.json > pilots.csv
jq -r '.upgrades | (map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv' inventory.json > upgrades.csv
jq -r '.ships | (map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv' inventory.json > ships.csv

Why does this exist

  1. My collection is far from complete, but I still have over 1100+ pilot and upgrade cards that don't fit in a single organizer or box, so I need a way to more accurately count by type and restrictions to help me organize.
  2. How do I get X if I don't have it? What am I actually missing out on if I don't pick up an expansion?
  3. List building tools are focused on the list building, so inventory management is a much lower priority for them.
  4. I also couldn't find anyone keeping an updated Excel template or anything else of that sort.
  5. I like the idea of being able to keep a copy of my inventory list local and flexible.
  6. Hopefully this is useful to someone else, as either an exercise in working xwing-data2 or as inspiration for something better.

Why rust?

  1. I'm not a JavaScript/coffee/typescript programmer and need an excuse to use rust at all since it is not my day job currently.
  2. I tried to use the pyxwb2 and immediately ran into having to do multiple checks for optional items such as restrictions, and figured I may as well get the compiler's help when working with them.

Challenges

  • XWS has a definitive definition of every item in the game, but xwing-data2 lacks a listing of expansion contents, so expansions.json will need to continue to be updated.

  • YASB uses names and not unique IDs in their collections and those change over time. YASB is pretty popular, so the goal will be to update to support importing from a YASB collection dump.

  • Windows and character encodings. Run the following nonsense in your PowerShell session before trying any of this:

    > [System.Console]::OutputEncoding=[System.Text.Encoding]::UTF8

Known Issues

  • YASB Collection Quirks
    • If you used YASP pre-2.0, your 1.0 expansions are still there, but of won't be in YASB, except for the core sets and the ships that came with obstacles, so they will print out as warning.
    • "First Edition VT-49 Decimator": Records appear to have been removed when the VT-49 was reprinted, so can't be imported like the other 1.0 obstacle sets.

Contributing to the this repo

Have a look at the issues.

This is a basic rust project with some tests run in GitHub Actions, try to add some tests for anything you are going to add.

Adding new expansions

  1. Update the xwing-data2 submodule to a version that includes the expansion contents.
  2. Add expansion to src/expansions/expansions.json.
  3. TODO
  4. Check if any ships can be removed from the swzunreleased placeholder.

Expansions

Wave numbers are based on sku, which is mostly related to the release date. This is in contrast to the waves in the wiki which groups by announcement date and separates some expansions which I think are better grouped by theme.

Initial expansions.json

See this terrible script.

Acknowledgements and Licenses

All Star Wars and X-Wing: TMG content itself is copyright and trademark of its owners: FFG/AMG/LucasArts.

The initial content for expansions.json and any yasb related conversions are from the yasb project, copyright 2012 Geordan Rosario and others uses under an MIT style license.

This also would not be possible with xwing-data2, also under an MIT license.

Other content fixes are from the X-Wing Miniatures: Second Edition Wiki, community content is covered by CC BY-SA.

xwingtmg2-inventory-rs's People

Contributors

awsaba avatar

Watchers

 avatar

xwingtmg2-inventory-rs's Issues

Moar data testing

Most of the tests are really tests over the data, but I've only tested with my collection and haven't exhaustively checked all the other expansions.

Create a test collection with 1 of everything and verify that the results are expected.

Embed default content and publish some binaries

Running this currently depends very much on being in the correct working directory (the root of this this repo).

A binary should be built that embeds the content for distribution and portability. It should still take paths to updated content as well for easy testing against new releases of xwing-data2.

Use lowercased AMG/FFG Item number as the unique ID for expansions.json

xws-ifying full expansion names as they are listed like "Star Wars X-Wing 2nd Ed: ARC-170 Starfighter" is maybe not the best way to refer to expansions in a "collection.json" document that is independent of the builders.

This would allow listing 1.0 ships with less ambiguity as well.

[
   {
      "item_no": "swz106",
      "name": "Rebel Alliance Squadron Starter Pack",
      "contents": [
          ...existing content list...
      ]

Clean up rust no-no's

There are some unwraps that could be handled more gracefully, even though this is pretty small util and likely can't do anything useful if any of them currently fail.

  • unwrap()
  • etc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.