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,8 +30,12 @@ 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.Grade == profileRaw.LevelID+1 { if (allPokememes[i].Pokememe.Defence < profileRaw.Power) || (allPokememes[i].Pokememe.Purchaseable) {
pokememesArray[allPokememes[i].Pokememe.Attack] = allPokememes[i] if len(pokememesArray) < 5 {
if allPokememes[i].Pokememe.Grade == profileRaw.LevelID+1 {
pokememesArray[allPokememes[i].Pokememe.Attack] = allPokememes[i]
}
}
} }
} }
} else if profileRaw.LevelID > 8 { } else if profileRaw.LevelID > 8 {
@ -45,7 +49,11 @@ func (p *Pokedexer) getBestPokememes(playerID int) (map[int]*dbmapping.PokememeF
} }
} }
if matchLeague { if matchLeague {
pokememesArray[allPokememes[i].Pokememe.Attack] = allPokememes[i] if (allPokememes[i].Pokememe.Defence < profileRaw.Power) || (allPokememes[i].Pokememe.Purchaseable) {
if len(pokememesArray) < 5 {
pokememesArray[allPokememes[i].Pokememe.Attack] = allPokememes[i]
}
}
} }
} }
} }
@ -59,7 +67,11 @@ func (p *Pokedexer) getBestPokememes(playerID int) (map[int]*dbmapping.PokememeF
} }
} }
if matchLeague { if matchLeague {
pokememesArray[allPokememes[i].Pokememe.Attack] = allPokememes[i] if (allPokememes[i].Pokememe.Defence < profileRaw.Power) || (allPokememes[i].Pokememe.Purchaseable) {
if len(pokememesArray) < 5 {
pokememesArray[allPokememes[i].Pokememe.Attack] = allPokememes[i]
}
}
} }
} }
} }