FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add Pokémon gen label to details marker. by BrownSlaughter · Pull Request #2475 · RocketMap/RocketMap · GitHub

Add Pokémon gen label to details marker. - #2475

Open
BrownSlaughter wants to merge 7 commits into
RocketMap:developfrom
BrownSlaughter:patch-1
Open

Add Pokémon gen label to details marker.#2475
BrownSlaughter wants to merge 7 commits into
RocketMap:developfrom
BrownSlaughter:patch-1

Conversation

BrownSlaughter commented Feb 1, 2018
edited
Loading

Copy link
Copy Markdown
Contributor

This adds generation info to RM and adds a small label to the pokemon label window

Motivation and Context

This PR is a precursor to things like "exclude by gen" and "generation % on stats page"

How Has This Been Tested?

Tested and run for a couple of days

needs testing with encounters running to check layout doesnt break

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [x ] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [ x] My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

sebastienvercammen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

RE: Discord: Generation info should be stored in a simple constant, since the generations are just a range of constant IDs. It'll reduce the amount of space needed to store the generation data.

Preferably in map.common.js, e.g.:

// Just as example:
// Gen 1 = [1, 100], Gen 2 = [101, 300], ...
const generations = [
    100,
    300
];

function getPokemonGen(pokemonId) {
    for (var gen = 1; gen <= generations.length; gen++) {
        let genMaxId = generations[gen - 1]
        if (pokemonId <= genMaxId) {
            return gen
        }
    }
    
    // ... this can't happen, Pokémon ID is out of the generation ranges
    console.log('Pokémon ID %s exceeds generation ranges.', pokemonId)
    return -1
}

There are a handful of other reasonable alternatives (simple ifs, and so on) with their pros and cons (this example being easy to add a new generation to).

sebastienvercammen changed the title Generation Addition and added to pokemon label window Add Pokémon gen label to details marker. Feb 2, 2018
ghost mentioned this pull request Feb 2, 2018
6 tasks
Comment thread pogom/utils.py
pokemon_gen = ' 1'
elif pokemon_id <= 251:
pokemon_gen = ' 2'
elif pokemon_id <= 386:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

get_pokemon_gen should be done on the front-end, not the back-end.

Comment thread pogom/app.py
pokemon_result = []
for p in pokemon:
p['pokemon_name'] = get_pokemon_name(p['pokemon_id'])
p['pokemon_gen'] = get_pokemon_gen(p['pokemon_id'])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Remove the gen from the back-end data.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL