pogo-data-generator
TypeScript icon, indicating that this package has built-in type declarations

1.17.0 • Public • Published

Pogo Data Generator

npm version Discord

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

Current Status

  • 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.

Installing/Usage

Package

// 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

Local Usage/Testing

  1. Clone the repo
  2. yarn install
  3. tsc will compile the TS into JS, then you can run yarn generate, which will generate a local masterfile.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 the base.ts file.
  • yarn pokeapi, which will generate a local masterfile.json and refresh the data in the static folder from PokeAPI
  • yarn raw will generate a local masterfile.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 categories
  • safe (boolean): Fetches an already built masterfile with known safe values
  • url (string): Custom url to fetch the masterfile from, results not guaranteed
  • test (boolean): Writes the masterfile to a local json
  • raw (boolean): Returns the data in its raw format without any template processing
  • pokeApi (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!

Package Sidebar

Install

npm i pogo-data-generator

Weekly Downloads

335

Version

1.17.0

License

Apache-2.0

Unpacked Size

200 kB

Total Files

43

Last publish

Collaborators

  • turtlesocks