Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jalyna/oakdex-pokedex
Ruby Gem and Node Package for comprehensive Generation 1-7 Pokedex data, including 809 Pokémon, uses JSON schemas to verify the data
https://github.com/jalyna/oakdex-pokedex
json json-schema nodejs pokedex pokemon ruby
Last synced: about 4 hours ago
JSON representation
Ruby Gem and Node Package for comprehensive Generation 1-7 Pokedex data, including 809 Pokémon, uses JSON schemas to verify the data
- Host: GitHub
- URL: https://github.com/jalyna/oakdex-pokedex
- Owner: jalyna
- License: mit
- Created: 2017-02-26T19:02:12.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-07-26T04:15:01.000Z (over 3 years ago)
- Last Synced: 2024-10-31T13:23:15.494Z (5 days ago)
- Topics: json, json-schema, nodejs, pokedex, pokemon, ruby
- Language: Ruby
- Homepage:
- Size: 10.4 MB
- Stars: 55
- Watchers: 4
- Forks: 13
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: MIT-LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
#
[![Gem Version](https://badge.fury.io/rb/oakdex-pokedex.svg)](https://badge.fury.io/rb/oakdex-pokedex) [![npm version](https://badge.fury.io/js/oakdex-pokedex.svg)](https://badge.fury.io/js/oakdex-pokedex) [![Build Status](https://travis-ci.org/jalyna/oakdex-pokedex.svg?branch=master)](https://travis-ci.org/jalyna/oakdex-pokedex) [![Code Climate](https://codeclimate.com/github/jalyna/oakdex-pokedex/badges/gpa.svg)](https://codeclimate.com/github/jalyna/oakdex-pokedex) [![Test Coverage](https://codeclimate.com/github/jalyna/oakdex-pokedex/badges/coverage.svg)](https://codeclimate.com/github/jalyna/oakdex-pokedex/coverage) [![Issue Count](https://codeclimate.com/github/jalyna/oakdex-pokedex/badges/issue_count.svg)](https://codeclimate.com/github/jalyna/oakdex-pokedex)
## Getting Started
### Ruby
Add oakdex to your Gemfile and do `bundle install`:
```ruby
gem 'oakdex-pokedex'
```Then you can use the library:
```ruby
require 'oakdex/pokedex'eevee = Oakdex::Pokedex::Pokemon.find('Eevee')
# => #{"fr"=>"Évoli", "de"=>"Evoli", "it"=>"Eevee", "en"=>"Eevee"}, "national_id"=>133 ...>bulbasaur = Oakdex::Pokedex::Pokemon.find(1)
# => #{"fr"=>"Bulbizarre", "de"=>"Bisasam", ...>bulbasaur.name
# => "Bulbasaur"bulbasaur.name('de')
# => "Bisasam"bulbasaur.types
# => ["Grass", "Poison"]bulbasaur.attributes
# => {"names"=>{"fr"=>"Bulbizarre", "de"=>"Bisasam", "it"=>"Bulbasaur", "en"=>"Bulbasaur"}, "national_id"=>1, "types"=>["Grass", "Poison"], "abilities"=>[{"name"=>"Overgrow"}, {"name"=>"Chlorophyll", "hidden"=>true}], "gender_ratios"=>{"male"=>87.5, "female"=>12.5}, "catch_rate"=>45, "egg_groups"=...}tackle = Oakdex::Pokedex::Move.find('Tackle')
# => #33, "pp"=>35, "max_pp"=>56, "power"=>50, "accuracy"=>100, "category"=>"physical", "priority"=>0, "target"=>"target", ...>potion = Oakdex::Pokedex::Item.find('Potion')
# => #{"en"=>"Potion", "de"=>"Trank", "fr"=>"Potion, ...>contrary = Oakdex::Pokedex::Ability.find('Contrary')
# => #126, "names"=>{"fr"=>"Contestation", "de"=>"Umkehrung", "it"=>"Inversione", "en"=>"Contrary"}, "descriptions"=>{"en"=>"Inverts stat modifiers.", "de"=>"Attacken, die einen Statuswert des Pokémon erhöhen würden, senken ihn und umgekehrt."}}>fairy = Oakdex::Pokedex::Type.find('Fairy')
# => #{"de"=>"Fee", "gr"=>"νεράιδα Neraida", "it"=>"Folletto", "pl"=>"Baśniowy (XY13) Bajkowy (XY46)", "en"=>"Fairy"}, "effectivness"=>{"Normal"=>1.0, "Fighting"=>2.0, "Flying"=>1.0, "Poison"=>0.5, "Ground"=>1.0, "Rock"=>1.0, "Bug"=>1.0, "Ghost"=>1.0, "Steel"=>0.5, "Fire"=>0.5, "Water"=>1.0, "Grass"=>1.0, "Electric"=>1.0, "Psychic"=>1.0, "Ice"=>1.0, "Dragon"=>2.0, "Dark"=>2.0, "Fairy"=>1.0}, "color"=>"#D685AD"}>
fairy.effectivness_for('Dark')
# => 2.0water1 = Oakdex::Pokedex::EggGroup.find('Water 1')
# => #{"en"=>"Water 1", "jp"=>"すいちゅう1 (水中1) Suichū1", "fr"=>"Eau 1", "de"=>"Wasser 1", "it"=>"Acqua 1", "es"=>"Agua 1"}}>generation6 = Oakdex::Pokedex::Generation.find('Generation VI')
# => #6, "dex_name"=>"kalos_id", "names"=>{"en"=>"Generation VI", "de"=>"Generation VI"}, "games"=>[{"en"=>"X", "de"=>"X"}, {"en"=>"Y", "de"=>"Y"}, {"en"=>"Omega Ruby", "de"=>"Omega Rubin"}, {"en"=>"Alpha Sapphire", "de"=>"Alpha Saphir"}]}>bold = Oakdex::Pokedex::Nature.find('Bold')
# => #{"en"=>"Bold", "de"=>"Kühn"}, "increased_stat"=>"def", "decreased_stat"=>"atk", "favorite_flavor"=>"Sour", "disliked_flavor"=>"Spicy"}>Oakdex::Pokedex::Pokemon.all.size
# => 809
Oakdex::Pokedex::Pokemon.where(type: 'Dark').size
# => 46
Oakdex::Pokedex::Pokemon.where(egg_group: 'Human-Like').size
# => 52
Oakdex::Pokedex::Pokemon.where(dex: 'alola').size
# => 307
Oakdex::Pokedex::Pokemon.where(alola_id: 1)
# => [#{"en"=>"Rowlet", "jp"=>"モクロー Mokuroh", "fr"=>"Brindibou", "es"=>"Rowlet", "de"=>"Bauz", "it"=>"Rowlet"}, "national_id"=>722, "alola_id"=>1, ...>]Oakdex::Pokedex::Move.where(type: 'Ground').size
# => 26Oakdex::Pokedex::Item.all.size
# => 69, still WIPOakdex::Pokedex::Item.where(category: 'Potion').size
# => 5
```### Javascript
Install the package:
```
$ npm install oakdex-pokedex --save
```Then you can use the library:
```js
oakdexPokedex = require('oakdex-pokedex');const eevee = oakdexPokedex.findPokemon('Eevee')
// returns data/pokemon/eevee.json
console.log(eevee.names.en); // Eeeveeconst charmander = oakdexPokedex.findPokemon(4)
// returns data/pokemon/charmander.json
console.log(charmander.names.en); // Charmanderconst tackle = oakdexPokedex.findMove('Tackle')
// returns data/move/tackle.json
console.log(m.names.en); // Tackleconst potion = oakdexPokedex.findItem('Potion')
// returns data/item/potion.json
console.log(m.names.en); // Potionconst contrary = oakdexPokedex.findAbility('Contrary')
// returns data/ability/contrary.json
console.log(a.names.en); // Contraryconst fairy = oakdexPokedex.findType('Fairy')
// returns data/type/fairy.json
console.log(fairy.names.en); // Fairyconst water1 = oakdexPokedex.findEggGroup('Water 1')
// returns data/egg_group/water_1.json
console.log(water1.names.en); // Water 1const genVI = oakdexPokedex.findGeneration('Generation VI')
// returns data/generation/6.json
console.log(genVI.names.en); // Generation VIconst bold = oakdexPokedex.findNature('Bold')
// returns data/nature/bold.json
console.log(bold.names.en); // Boldconst allPokemon = oakdexPokedex.allPokemon()
console.log(allPokemon.length); // 809const allItems = oakdexPokedex.allItems()
console.log(allItems.length); // 69, WIPconst darkPokemon = oakdexPokedex.allPokemon({ type: 'Dark' })
console.log(darkPokemon.length); // 46const humanLike = oakdexPokedex.allPokemon({ egg_group: 'Human-Like' })
console.log(humanLike.length); // 52const alola = oakdexPokedex.allPokemon({ dex: 'alola' })
console.log(alola.length); // 302const moves = oakdexPokedex.allMoves({ type: 'Ground' })
console.log(moves.length); // 26
```### Add custom Pokemon / Fakemon
You can add your own Pokémon and it will be checked if it is valid. You can and should add them as a batch as evolutions need to present at the same time.
Fakemon need to have a national_id that is greater than 10000.
Checkout [the fakemon examples](fixtures).
```rb
fakemon_stage1 = File.read('my_fakemon1.json')
fakemon_stage2 = File.read('my_fakemon2.json')Oakdex::Pokedex::Pokemon.import!([fakemon_stage1, fakemon_stage2])
Oakdex::Pokedex::Pokemon.find('My Fakemon')
``````js
fakemonStage1 = fs.readFileSync('./fixtures/my_fakemon1.json', 'utf8')
fakemonStage2 = fs.readFileSync('./fixtures/my_fakemon2.json', 'utf8')oakdexPokedex.importPokemon([fakemonStage1, fakemonStage2])
oakdexPokedex.findPokemon('My Fakemon')
```### Schemas
If you want to know what the structure of the given data is, checkout the following documentations:
- [Pokemon](doc/pokemon.md)
- [Item](doc/item.md)
- [Move](doc/move.md)
- [Ability](doc/ability.md)
- [Type](doc/type.md)
- [Egg Group](doc/egg_group.md)
- [Nature](doc/nature.md)
- [Generation](doc/generation.md)
- [Region](doc/region.md)### Sprites
If you want also to include sprites in your pokedex, check out [oakdex-pokedex-sprites](https://github.com/jalyna/oakdex-pokedex-sprites).
## Contributing
I would be happy if you want to add your contribution to the project. In order to contribute, you just have to fork this repository.
Please respect the [Code of Conduct](//github.com/jalyna/oakdex-pokedex/blob/master/CODE_OF_CONDUCT.md).
### Minify json files before releasing new version:
```
$ rake compress_data:run
```## License
MIT License. See the included MIT-LICENSE file.
## Credits
Logo Icon by [Roundicons Freebies](http://www.flaticon.com/authors/roundicons-freebies).