Coder Social home page Coder Social logo

supeffective / koffing Goto Github PK

View Code? Open in Web Editor NEW
20.0 1.0 1.0 1.86 MB

Online Pokémon Showdown Team parser that converts your competitive strategies to machine-readable JSON code.

Home Page: https://itsjavi.com/koffing/

License: MIT License

TypeScript 100.00%
smogon pokemon showdown pokemon-showdown smogon-api pokemonshowdown pokemonsimulator pokepaste

koffing's Introduction

Koffing

npm version Build Status

Koffing is a Pokemon Showdown importable-syntax parser for JavaScript and TypeScript.

Pokémon Showdown is the most popular online Pokémon battle simulator, one of the best ways to quickly try your strategies for the official Pokémon VGC Championships. This library is just a parser for the teams generated by the Showdown Team Builder exports.

This repository holds the source code for the library as well as the code for the Online Parser. The Online Parser does not require you to download any library or script, it is recommended if all you want is to sanitize, prettify or convert to JSON your Showdown team exports.

Features

  • Compatible with Gen 9 Pokémon definitions
  • Compatible with web browsers, ES6+, TypeScript and NodeJS
  • Converts from Showdown code to JSON and vice-versa
  • Sanitizes Showdown code (removing invalid data, applying max and mins values, etc.)
  • Prettifies Showdown code (proper indentation, line breaks and sorting of the data, etc.)
  • Online Parser, which is using the library featuring all the above mentioned.

Installation

As a package:

npm i koffing

# or

pnpm add koffing

Usage

Javascript (ES5, web)

<script src="https://unpkg.com/koffing@latest/dist/index.js"></script>
<script>
  var teamCode = `=== [gen7] Folder 1/Example Team ===`
  var parsedTeam = Koffing.parse(teamCode)
  console.log(parsedTeam)

  // Note that the ShowdownParser class, which is used internally by the Koffing class
  // is also exposed in the global scope:
  console.log(new ShowdownParser(teamCode).parse())
</script>

Javascript/TypeScript (ES Modules)

'use strict'

import { Koffing } from 'https://unpkg.com/koffing@latest/dist/index.mjs'
// or
import { Koffing } from 'koffing'

const teamCode = `
=== [gen7] Folder 1/Example Team ===

Smogon (Koffing) (F) @ Eviolite
Level: 5
Ability: Levitate
Shiny: Yes
Happiness: 255
EVs: 36 HP / 236 Def / 236 SpD
IVs: 31 HP / 30 Atk / 31 SpA / 30 SpD / 31 Spe
Bold Nature
- Will-O-Wisp
- Pain Split
- Sludge Bomb
- Fire Blast`

const parsedTeam = Koffing.parse(teamCode)

// This will log a PokemonTeamSet object:
console.log(parsedTeam)

// Convert it back to the Showdown format (prettified). These 3 lines are equivalent:
console.log(parsedTeam.toShowdown())
console.log(parsedTeam.toString())
console.log(parsedTeam + '')

NodeJS

const Koffing = require('koffing').Koffing

const teamCode = `=== [gen7] Folder 1/Example Team ===`
const parsedTeam = Koffing.parse(teamCode)

License

This software is copyrighted and licensed under the MIT license.

Disclaimer

This software comes bundled with data and graphics extracted from the Pokémon series of video games. Some terminology from the Pokémon franchise is also necessarily used within the software itself. This is all the intellectual property of Nintendo, Creatures, inc., and GAME FREAK, inc. and is protected by various copyrights and trademarks.

The authors believe that the use of this intellectual property for a fan reference is covered by fair use and that the software is significantly impaired without said property included. Any use of this copyrighted property is at your own legal risk.

This software is not affiliated in any way with Nintendo, Pokémon or any other game company.

A complete revision history of this software is available from https://github.com/itsjavi/koffing

koffing's People

Contributors

dependabot[bot] avatar geodaz avatar itsjavi avatar renovate[bot] avatar route1rodent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

dellix

koffing's Issues

feature: create a CLI-mode parser

Create an executable node file (#!/usr/bin/env node) that supports one argument as the showdown text and prints the JSON representation of it.
Also provide a way to do the opposite.

docs: add Showdown links

Add links to the Showdown simulator so people finding the library will know better what is it about

improve the online parser layout

  • in xs mode the grid is not full width
  • equal width colums would look better
  • add a little description of the project
  • add labels to each box (input and output)
  • consider adding the "readme.md" as an "about" section (may require routing)

nice to have in the future:

  • build pokemon cards with the pokemon icons
  • show Pokemon type coverage charts for: resistances and stab types

refactor showdown parser script

The parser script is still in an initial prototype state,
consider refactor it so the code is more efficient, reusable and legible.

feature: build team cards

Just to give an idea of the info distribution:

dyizux_xuaa2rma

Initially we can even do it text-only.
The idea is to give the possibility to create a nice team view for capturing it and sharing in social media, forums, etc. But I think it may be an entire project itself.
We can even consider moving the /docs to a koffing-online project.

add tests

Add basic test coverage using Jest

rewrite the web app with nextjs 13

  • rewrite the web app using nextjs 13, react 18 and typescript
  • rewrite the gh-pages publish script to publish the static version of the nextjs app
  • cleanup code

Gen 9

Hello, will you update this parser with Teracrystalisation ?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • chore(deps): update dependency @types/node to v20.4.9
  • fix(deps): update typescript-eslint monorepo to v6.3.0 (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/test.yml
  • actions/checkout v3
  • pnpm/action-setup v2
  • actions/setup-node v3
npm
package.json
  • husky ^8.0.3
  • turbo ^1.10.12
  • node >=18.5.0
  • pnpm 8.6.12
packages/koffing-pages/package.json
  • @types/node 20.4.8
  • @types/react 18.2.19
  • @types/react-dom 18.2.7
  • eslint 8.46.0
  • eslint-config-next 13.4.13
  • next 13.4.13
  • react 18.2.0
  • react-dom 18.2.0
  • typescript 5.1.6
packages/koffing/package.json
  • @types/jest ^29.5.3
  • @types/node ^20.4.7
  • jest ^29.6.2
  • ts-jest ^29.1.1
  • tsup ^7.2.0
  • typescript ^5.1.6
packages/preset-eslint/package.json
  • @typescript-eslint/eslint-plugin ^6.2.1
  • @typescript-eslint/parser ^6.2.1
  • eslint ^8.46.0
  • eslint-config-prettier ^9.0.0
  • eslint-config-turbo ^1.10.12
packages/preset-prettier/package.json
  • prettier ^3.0.1
packages/preset-ts/package.json
  • typescript 5.1.6

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.