Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
LokiMidgard committed Dec 10, 2020
1 parent d1be26f commit 6920e37
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 50 deletions.
80 changes: 31 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,83 +1,65 @@
# spirit-island-renderer
# Spirit Island Renderer

this tool renders custom spirits and there unique powers. It uses [spirit-island-template](https://github.com/Gudradain/spirit-island-template) and render those with [node-html-to-image](https://github.com/frinyvonnick/node-html-to-image)


## Early Development
![console screenshot](docs/console.png)

This project just started.

* [x] Spirit Front
* [x] Spirit Back (Lore)
* [x] Unique Power cards
* [x] Unique Power Cards Back
this tool renders custom spirits and there unique powers. It uses [spirit-island-template](https://github.com/Gudradain/spirit-island-template) and render those with [node-html-to-image](https://github.com/frinyvonnick/node-html-to-image)

* [ ] Create automatic import script for Tabletop simulator

## Getting started

>You need to have [node](https://nodejs.org/) installed. We assume you have added it to your PATH when you installed it.
Create a JSON file that holds all your spirit data. Look in the sample folder for an example or use it as your first spirit. The JSON file needs to be conform to the json schema in this repo. If your code editor supports JSON-Schema, you can enable auto-completion and warnings adding the following entry at the top:
```json
{
"$schema": "https://raw.githubusercontent.com/LokiMidgard/spirit-island-renderer/development/spirit-schema.json",
// your spirit data like name etc...
}
```

*The sample uses the local schema file in this repo so when you move the JSON it will no longer find the schema. Replace the schema entry in the sample with the one above.*



### Get the program
Install the program using npm
The fastest way is to start is with the sample.

```bash
npm i spirit-island-renderer -g
```
# This generates an folder myTestSpirt and put the sample inside
npx spirit-island-renderer --generate-sample myTestSpirit

then execute it using

```bash
npm exec sir <spirit-file.json>
# This will generate the sample spirit
npx spirit-island-renderer myTestSpirit\Ashes-renews-the-land.json

# now you'll find the images of the spirit in the out folder
```

Take a look at `myTestSpirut/Ashes-renews-the-land.json`. Changing some values and executing `npx spirit-island-renderer myTestSpirit\Ashes-renews-the-land.json` from the parent folder again will change the images of the spirit. Try it out.

**OR**

Download this repository

If you open the JSON file in an editor that can handle JSON schema like [VSCode](https://code.visualstudio.com/Download) you get autocompletion and warnings if you put some values where they do not belong.

Execute `-h` to print the help and find out what you can do
```bash
# Init the submodules
git submodule init
git submodule update

# Install the dependencys
npm install

# Create your first spirit
npm run render <spirit-file.json>
npx spirit-island-renderer -h
```

------------------------------

------------------------------


You can also look in the sample folder.

To use the correct fonts copy the fonts to the folder `dependencys/fonts`. You will find a read me there describing what you need. The fonts are needed for [spirit-island-template](https://github.com/Gudradain/spirit-island-template) where you can find a description how to obtain a copy of those files.

### Sample output

![Face of the spirit board](docs/Ashes%20renews%20the%20land.json-front.png)
![Lore of the spirit board](docs/Ashes%20renews%20the%20land.json-lore.png)
![Back of the unique power card](docs/Ashes%20renews%20the%20land.json-cards-back.png" )
![Back of the unique power card](docs/Ashes%20renews%20the%20land.json-cards-back.png)
![Face of the unique power card](docs/Ashes%20renews%20the%20land.json-cards.png "Face of the unique power card")

## Development

When you clone do not forget the sub modules

```bash
# Init the submodules
git submodule init
git submodule update

```
you can test the code with following command
```bash
# Create your first spirit
npm run render -- <spirit-file.json>

```

If you change the spirit type you need to execute

```bash
Expand Down
Binary file added docs/console.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/generateSample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export async function HandleSample(cmd: parsed): Promise<void> {
console.error(chalk.red(`\tThe path ${chalk.blue(relativJsonPath)} contains spaces. Unfortunatly npx does not support spaces ${chalk.yellowBright('(¬_¬;)')} `))
}
else {
console.log(chalk.greenBright(`\tnpx sir ${chalk.blue(relativJsonPath)} `))
console.log(chalk.greenBright(`\tnpx spirit-island-renderer ${chalk.blue(relativJsonPath)} `))
}
}
}

0 comments on commit 6920e37

Please sign in to comment.