th3mouk/pokemongo-iv-calc

The most accurate PHP lib to calculate Pokemon Go IV

1.7.0 2017-10-30 16:01 UTC

This package is auto-updated.

Last update: 2024-03-26 01:34:24 UTC


README

This PHP library is the most accurate to calculate Pokemons IV's.

Latest Stable Version Latest Unstable Version Total Downloads License

SensioLabsInsight Build Status Scrutinizer Code Quality

Installation

composer require th3mouk/pokemongo-iv-calc

Usage

From command line

php bin/ivcalculator calculate bulbasaur 515 59 2500 4 3 def

php bin/ivcalculator calculate bulbasaur xxx xx 2500 4 3 def atk hp

Use the class

$pokemon = (new Calculator())->calculate(
    $input->getArgument('name'),
    (int) $input->getArgument('cp'),
    (int) $input->getArgument('hp'),
    (int) $input->getArgument('dusts'),
    (int) $input->getArgument('global'),
    (int) $input->getArgument('max-stats'),
    $input->getArgument('bests'),
    (bool) $input->getOption('upgraded')
);

To manipulate different IV combinaisons I use Illuminate\Collection.

So pokemon->getIvCombinaisons() will return a Collection easily manipulable.

Parameters:

  • Name of the pokemon in english 🇬🇧
  • CP
  • HP
  • Dusts
  • 1/2/3/4 see steps here
  • 1/2/3/4 see steps here
  • Finish the command with stats given by the coach (atk and/or def and/or hp)

Where :

1 is the worst appreciation (<8 for an IV or <50% for global)

And

4 is the best range (15 for an IV or >80% global IV)

Helpers

Simply use static Helper with in first argument the pokemon level and second your trainer level.

Dusts calculator

Helpers::dustsToMax(20.5, 20)

Candies calculator

Helpers::candiesToMax(23, 27)

CP calculator

Helpers::calculateCP(238, 184, 171, 29, true)

Contributing

Before commiting, please run vendor/bin/php-cs-fixer fix . command, and update the test suite.

To launch the test suite:

php vendor/bin/peridot tests

Please

Feel free to improve this library.