Add Pokémon gen label to details marker.#2475
Open
BrownSlaughter wants to merge 7 commits intoRocketMap:developfrom
BrownSlaughter:patch-1
Open
Add Pokémon gen label to details marker.#2475BrownSlaughter wants to merge 7 commits intoRocketMap:developfrom BrownSlaughter:patch-1
BrownSlaughter wants to merge 7 commits intoRocketMap:developfrom
BrownSlaughter:patch-1
Conversation
sebastienvercammen
requested changes
Feb 2, 2018
Member
sebastienvercammen
left a comment
There was a problem hiding this comment.
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).
6 tasks
sebastienvercammen
requested changes
Mar 1, 2018
| pokemon_gen = ' 1' | ||
| elif pokemon_id <= 251: | ||
| pokemon_gen = ' 2' | ||
| elif pokemon_id <= 386: |
Member
There was a problem hiding this comment.
get_pokemon_gen should be done on the front-end, not the back-end.
| pokemon_result = [] | ||
| for p in pokemon: | ||
| p['pokemon_name'] = get_pokemon_name(p['pokemon_id']) | ||
| p['pokemon_gen'] = get_pokemon_gen(p['pokemon_id']) |
Member
There was a problem hiding this comment.
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Checklist: