Generates templated data for Pokemon GO related projects, including:
- Pokemon
- Forms
- Costumes
- Moves
- Items
- Team Rocket Invasions
- Pokemon Types
- Weather
- Translations
- Quest Conditions
- Quest Types
- Quest Reward Types
- Future Pokemon via PokeAPI
- Internally the typing is strong, however, the return results are typed pretty horribly due to this being my first TypeScript project. Going to work on this in the 2.0 release.
// with npm
npm install pogo-data-generator
// with yarn
yarn add pogo-data-generator
Usage:
// commonJS
const { generate } = require('pogo-data-generator')
// es6 with invasion function
import { generate, invasions } from 'pogo-data-generator'
const data = await generate() // returns the default settings
const template = {
pokemon: {
enabled: true,
options: {
snake_case: true,
unsetDefaultForm: true,
},
template: {
pokemonName: true,
pokedexId: true,
forms: {
formName: true,
proto: true,
},
},
},
types: {
enabled: true,
template: {
typeName: true,
},
},
moves: {
enabled: false,
},
items: {
enabled: true,
options: {
customFields: {
itemId: 'id',
},
},
template: {
itemId: true,
type: true,
minTrainerLevel: true,
},
},
questRewards: {
enabled: false,
},
questConditions: {
enabled: false,
},
invasions: {
enabled: true,
},
weather: {
enabled: true,
},
translations: {
enabled: true,
options: {
masterfileLocale: 'de',
},
locales: {
en: true,
de: true,
},
},
}
const customData = await generate({ template }) // returns custom templated data
const tr = await invasions()
// returns the default settings
- Clone the repo
yarn install
tsc
will compile the TS into JS, then you can runyarn generate
, which will generate a localmasterfile.json
for you to checkout
tsc -w
will auto recompile the TypeScript during development- You can play with the input options by changing the scripts in
package.json
or modifying thebase.ts
file. yarn pokeapi
, which will generate a localmasterfile.json
and refresh the data in thestatic
folder from PokeAPIyarn raw
will generate a localmasterfile.json
and with the raw data format
The generate function accepts an object with the following properties:
template
(object): Your template for each of the categoriessafe
(boolean): Fetches an already built masterfile with known safe valuesurl
(string): Custom url to fetch the masterfile from, results not guaranteedtest
(boolean): Writes the masterfile to a local jsonraw
(boolean): Returns the data in its raw format without any template processingpokeApi
(boolean): Fetches fresh data from PokeAPI
To view some static examples of what this library can create, check out these repos: Masterfiles Translations
To view the full list of available options, check out the Wiki!