Getting Started
Ruby
Add oakdex to your Gemfile and do bundle install
:
Then you can use the library:
eevee = Oakdex::Pokedex::Pokemon.find('Eevee')# => #<Oakdex::Pokedex::Pokemon:0x007fe3dd6a88f8 @attributes={"names"=>{"fr"=>"Évoli", "de"=>"Evoli", "it"=>"Eevee", "en"=>"Eevee"}, "national_id"=>133 ...> bulbasaur = Oakdex::Pokedex::Pokemon.find(1)# => #<Oakdex::Pokedex::Pokemon:0x007fe3dc55da80 @attributes={"names"=>{"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')# => #<Oakdex::Pokedex::Move:0x007fbc9a10cda0 @attributes={"index_number"=>33, "pp"=>35, "max_pp"=>56, "power"=>50, "accuracy"=>100, "category"=>"physical", "priority"=>0, "target"=>"target", ...> potion = Oakdex::Pokedex::Item.find('Potion')# => #<Oakdex::Pokedex::Item:0x007fd48f1b14b0 @attributes={"names"=>{"en"=>"Potion", "de"=>"Trank", "fr"=>"Potion, ...> contrary = Oakdex::Pokedex::Ability.find('Contrary')# => #<Oakdex::Pokedex::Ability:0x007fbc9b033540 @attributes={"index_number"=>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')# => #<Oakdex::Pokedex::Type:0x007fbc9a943c30 @attributes={"names"=>{"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.0 water1 = Oakdex::Pokedex::EggGroup.find('Water 1')# => #<Oakdex::Pokedex::EggGroup:0x007fbc9a853398 @attributes={"names"=>{"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')# => #<Oakdex::Pokedex::Generation:0x007fbc9b0382c0 @attributes={"number"=>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')# => #<Oakdex::Pokedex::Nature:0x007fbc9a92b2c0 @attributes={"names"=>{"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)# => [#<Oakdex::Pokedex::Pokemon:0x007fbc9e542510 @attributes={"names"=>{"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# => 26 Oakdex::Pokedex::Item.all.size# => 69, still WIP Oakdex::Pokedex::Item.where(category: 'Potion').size# => 5
Javascript
Install the package:
$ npm install oakdex-pokedex --save
Then you can use the library:
oakdexPokedex = ; const eevee = oakdexPokedex// returns data/pokemon/eevee.jsonconsole; // Eeevee const charmander = oakdexPokedex// returns data/pokemon/charmander.jsonconsole; // Charmander const tackle = oakdexPokedex// returns data/move/tackle.jsonconsole; // Tackle const potion = oakdexPokedex// returns data/item/potion.jsonconsole; // Potion const contrary = oakdexPokedex// returns data/ability/contrary.jsonconsole; // Contrary const fairy = oakdexPokedex// returns data/type/fairy.jsonconsole; // Fairy const water1 = oakdexPokedex// returns data/egg_group/water_1.jsonconsole; // Water 1 const genVI = oakdexPokedex// returns data/generation/6.jsonconsole; // Generation VI const bold = oakdexPokedex// returns data/nature/bold.jsonconsole; // Bold const allPokemon = oakdexPokedexconsole; // 809 const allItems = oakdexPokedexconsole; // 69, WIP const darkPokemon = oakdexPokedexconsole; // 46 const humanLike = oakdexPokedexconsole; // 52 const alola = oakdexPokedexconsole; // 302 const moves = oakdexPokedexconsole; // 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.
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')
fakemonStage1 = fsfakemonStage2 = fs oakdexPokedex oakdexPokedex
Schemas
If you want to know what the structure of the given data is, checkout the following documentations:
Sprites
If you want also to include sprites in your pokedex, check out 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.
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.