https://github.com/benjaminparisel/sw-monster-parser
A sw monster parser based on swarfam
https://github.com/benjaminparisel/sw-monster-parser
tool
Last synced: 12 months ago
JSON representation
A sw monster parser based on swarfam
- Host: GitHub
- URL: https://github.com/benjaminparisel/sw-monster-parser
- Owner: benjaminParisel
- License: mit
- Created: 2023-04-19T12:10:19.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-21T20:07:23.000Z (about 3 years ago)
- Last Synced: 2025-03-14T08:39:24.942Z (over 1 year ago)
- Topics: tool
- Language: TypeScript
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# sw-monster-parser
Call recursively the API to retrieve each monster data
## Pre-requisite
[Generate a swarfarm token](https://github.com/swarfarm/swarfarm#jwt-authentication) and copy it on `src/example.ts` for `API_TOKEN` constant.
## Setup
1. Run `npm install`, or `pnpn install` or `yarn install`
2. Run `pnpn run start`
3. In `output` folder, you will found a sw-monsters.json file.
## Usage
- Create a ts file to make your result as you need, an example on src/example.ts is done.
- You can now run `ts-node ./src/example.ts`
## Customize
You can update mapping to define a Function with custom mapping, like is done on example.ts file.
```
const customMapping = ({ name, element, com2us_id, family_id, image_filename, natural_stars, base_stars, awaken_level, awakens_from,awakens_to }: any): Monster => ({
name,
element,
com2us_id,
family_id,
image_filename,
natural_stars,
isAwaken: (natural_stars != base_stars),
isDoubleAwaken: (awaken_level == 2),
awakens_from,
awakens_to
});
```
Warning: Don't forget to update Monster interface if you need more info mapping
# Acknowledgments
- [SwarfarmAPI](https://github.com/swarfarm/swarfarm) to retrieve all monster data