Archived
1

/best pokememes are now filtered by defence and purchaseability

This commit is contained in:
Vladimir Hodakov 2018-02-07 13:39:34 +04:00
parent 56987f001a
commit 5a746b524b

View File

@ -30,10 +30,14 @@ func (p *Pokedexer) getBestPokememes(playerID int) (map[int]*dbmapping.PokememeF
allPokememes := c.DataCache.GetAllPokememes() allPokememes := c.DataCache.GetAllPokememes()
if profileRaw.LevelID < 4 { if profileRaw.LevelID < 4 {
for i := range allPokememes { for i := range allPokememes {
if (allPokememes[i].Pokememe.Defence < profileRaw.Power) || (allPokememes[i].Pokememe.Purchaseable) {
if len(pokememesArray) < 5 {
if allPokememes[i].Pokememe.Grade == profileRaw.LevelID+1 { if allPokememes[i].Pokememe.Grade == profileRaw.LevelID+1 {
pokememesArray[allPokememes[i].Pokememe.Attack] = allPokememes[i] pokememesArray[allPokememes[i].Pokememe.Attack] = allPokememes[i]
} }
} }
}
}
} else if profileRaw.LevelID > 8 { } else if profileRaw.LevelID > 8 {
// TODO: Remove it on 10th grade pokememes arrival // TODO: Remove it on 10th grade pokememes arrival
for i := range allPokememes { for i := range allPokememes {
@ -45,10 +49,14 @@ func (p *Pokedexer) getBestPokememes(playerID int) (map[int]*dbmapping.PokememeF
} }
} }
if matchLeague { if matchLeague {
if (allPokememes[i].Pokememe.Defence < profileRaw.Power) || (allPokememes[i].Pokememe.Purchaseable) {
if len(pokememesArray) < 5 {
pokememesArray[allPokememes[i].Pokememe.Attack] = allPokememes[i] pokememesArray[allPokememes[i].Pokememe.Attack] = allPokememes[i]
} }
} }
} }
}
}
} else { } else {
for i := range allPokememes { for i := range allPokememes {
if allPokememes[i].Pokememe.Grade == profileRaw.LevelID+1 { if allPokememes[i].Pokememe.Grade == profileRaw.LevelID+1 {
@ -59,11 +67,15 @@ func (p *Pokedexer) getBestPokememes(playerID int) (map[int]*dbmapping.PokememeF
} }
} }
if matchLeague { if matchLeague {
if (allPokememes[i].Pokememe.Defence < profileRaw.Power) || (allPokememes[i].Pokememe.Purchaseable) {
if len(pokememesArray) < 5 {
pokememesArray[allPokememes[i].Pokememe.Attack] = allPokememes[i] pokememesArray[allPokememes[i].Pokememe.Attack] = allPokememes[i]
} }
} }
} }
} }
}
}
return pokememesArray, true return pokememesArray, true
} }