New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Pokémon gen label to details marker. #2475
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 if
s, and so on) with their pros and cons (this example being easy to add a new generation to).
pokemon_gen = ' 1' | ||
elif pokemon_id <= 251: | ||
pokemon_gen = ' 2' | ||
elif pokemon_id <= 386: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_pokemon_gen
should be done on the front-end, not the back-end.
@@ -34,6 +34,7 @@ def convert_pokemon_list(pokemon): | |||
pokemon_result = [] | |||
for p in pokemon: | |||
p['pokemon_name'] = get_pokemon_name(p['pokemon_id']) | |||
p['pokemon_gen'] = get_pokemon_gen(p['pokemon_id']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the gen from the back-end data.
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: