Skip to content

stumpyzevon/war.cards

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

war.cards

NPM version NPM version

This is a collection of Javascript utilities for manipulating Battlescribe rosters.

These utilities are used in the https://war.cards roster editor.

There is also a live demo here. The code for the demo is in the examples folder of this repository.

For additional help, hit up @stumpyzevon in the war.cards Discord channel.

Usage

First install the roster package:

  $ npm install @war.cards/roster

Then load a roster from the .ros XML data. In this snippet it's loaded from a file, but it could be string data from an HTML File object:

import { createRosterFromXML } from '@war.cards/roster';
import fs from 'fs';

const rosterData = fs.readFileSync('./test_roster.ros');
const roster = createRosterFromXML(rosterData.toString());

roster.forces.forEach((force) => {
  console.log(force._name);
  force.selections.forEach((selection) => {
    console.log(selection._name);
  });
});

Docs

Coming soon! For now you can browse the roster.js and selection.js source files to see how the objects are structured and what functions are available.

Example

There is an example roster viewer in the examples folder. It's currently published here.

The example doesn't use any particular Javascript framework, but it does use Bootstrap.

It uses the localforage package to store the serialized roster in the browser.

About

Packages to manipulate BSData... data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published