hdkv
/
i2_bot
Archived
1
Fork 0

/best pokememes are now filtered by defence and purchaseability

master
Vladimir Hodakov 2018-02-07 13:39:34 +04:00
parent 56987f001a
commit 5a746b524b
1 changed files with 16 additions and 4 deletions

View File

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