From add06f90f4ea2fc32be7c198c14daf76e9319d48 Mon Sep 17 00:00:00 2001 From: Vladimir Hodakov Date: Tue, 30 Jan 2018 00:55:14 +0400 Subject: [PATCH] /best command works for levels, where no upper pokememes exists --- lib/pokedexer/getters.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/pokedexer/getters.go b/lib/pokedexer/getters.go index 1cee1b5..e01cb70 100644 --- a/lib/pokedexer/getters.go +++ b/lib/pokedexer/getters.go @@ -34,6 +34,21 @@ func (p *Pokedexer) getBestPokememes(playerID int) (map[int]*dbmapping.PokememeF pokememesArray[allPokememes[i].Pokememe.Attack] = allPokememes[i] } } + } else if profileRaw.LevelID > 8 { + // TODO: Remove it on 10th grade pokememes arrival + for i := range allPokememes { + if allPokememes[i].Pokememe.Grade == 9 { + matchLeague := false + for j := range allPokememes[i].Elements { + if allPokememes[i].Elements[j].LeagueID == playerRaw.LeagueID { + matchLeague = true + } + } + if matchLeague { + pokememesArray[allPokememes[i].Pokememe.Attack] = allPokememes[i] + } + } + } } else { for i := range allPokememes { if allPokememes[i].Pokememe.Grade == profileRaw.LevelID+1 {