Archived
1

/best for low-levels shows all pokememes of next grade

This commit is contained in:
Vladimir Hodakov 2017-11-29 19:59:51 +04:00
parent 099898d991
commit da8fe3f3e8
2 changed files with 15 additions and 7 deletions

View File

@ -105,10 +105,18 @@ func (p *Pokedexer) getBestPokememes(playerID int) ([]dbmapping.PokememeFull, bo
// TODO: make it more complicated // TODO: make it more complicated
pokememes := []dbmapping.Pokememe{} pokememes := []dbmapping.Pokememe{}
err := c.Db.Select(&pokememes, c.Db.Rebind("SELECT p.* FROM pokememes p, pokememes_elements pe, elements e WHERE e.league_id = ? AND p.grade = ? AND pe.element_id = e.id AND pe.pokememe_id = p.id ORDER BY p.attack DESC"), playerRaw.LeagueID, profileRaw.LevelID+1) if profileRaw.LevelID < 4 {
if err != nil { err := c.Db.Select(&pokememes, c.Db.Rebind("SELECT * FROM pokememes WHERE grade = ? ORDER BY attack DESC"), profileRaw.LevelID+1)
c.Log.Error(err) if err != nil {
return pokememesArray, false c.Log.Error(err)
return pokememesArray, false
}
} else {
err := c.Db.Select(&pokememes, c.Db.Rebind("SELECT p.* FROM pokememes p, pokememes_elements pe, elements e WHERE e.league_id = ? AND p.grade = ? AND pe.element_id = e.id AND pe.pokememe_id = p.id ORDER BY p.attack DESC"), playerRaw.LeagueID, profileRaw.LevelID+1)
if err != nil {
c.Log.Error(err)
return pokememesArray, false
}
} }
pokememesArray, ok = p.formFullPokememes(pokememes) pokememesArray, ok = p.formFullPokememes(pokememes)

View File

@ -477,12 +477,12 @@ func (s *Squader) ProcessMessage(update *tgbotapi.Update, chatRaw *dbmapping.Cha
} }
if !isChatValid { if !isChatValid {
switch newUsers[i].UserName { switch strings.ToLower(newUsers[i].UserName) {
case "gantz_yaka": case "gantz_yaka":
messageProcessed = true messageProcessed = true
case "@agentpb": case "agentpb":
messageProcessed = true messageProcessed = true
case "@pbhelp": case "pbhelp":
messageProcessed = true messageProcessed = true
default: default:
s.kickUserFromSquadChat(&newUsers[i], chatRaw) s.kickUserFromSquadChat(&newUsers[i], chatRaw)